5

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

3 Answers 3

7

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

Sign up to request clarification or add additional context in comments.

Comments

4

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

EDIT:

var
  s : string;

...

initialization

  s := myfunction();

...

Comments

0

No, you have to declare an assign the variable separately:

var
  s : string;
begin
  s := myfunction(); 
  ...
end;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.