Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi initial value as a function result

Tags:

delphi

is it possible to declare a string var and give it the result of a function as initial value like this or similar :

var
 s : string = myfunction();

Thanks

like image 287
user382591 Avatar asked Nov 11 '11 17:11

user382591


2 Answers

No, Delphi language (or Object Pascal, whatever it is called at the moment) doesn't support that.

like image 142
gabr Avatar answered Nov 11 '22 03:11

gabr


No, but you could do that from the initialization section of the unit.

EDIT:

var
  s : string;

...

initialization

  s := myfunction();

...
like image 31
Jerry Gagnon Avatar answered Nov 11 '22 03:11

Jerry Gagnon