What is the default value of 'Result' in Delphi? -


Is there a guaranteed default value for a function's result variable, such as 0, '' Or zero? Or should always be done initially before using results ?

I have such function return function:

  function Foo (): String start while {...} results: = result + 'bingbootsask'; End;   

It worked fine, but now I get some strings containing the contents from the previous call in the function. When I add a result: = '' in the beginning, then it's okay. When do I need to start the results variable and when should I do it? Type of function Return value String

/ Code> is actually treated by the compiler as a separate diverse parameter when the function execution starts, then whatever the value is in local code in the result variable returns the return value Will be done.

In this way you should always start the function return value. This advice is for all data types, not just for the wire.

This issue was discussed here yesterday.

Comments