1

How and when should these keywords be used?

Do they have the same purpose as in C#?

Community
  • 1
  • 1

1 Answers1

7

The documentation suggests they are exactly the same as in C#:

  • 'out' from the caller side: you may pass an uninitialised variable to the method and you may expect it to be initialised after the method returns
  • 'out' from callee side: the parameter is considered uninitialised and you have to initialise it
  • 'ref' from caller side: the variable you're passing to the method has to be initialised and it may be changed or not by the method
  • 'ref' from callee side: the parameter is considered initialised and you may change it or not
Mike Chamberlain
  • 39,692
  • 27
  • 110
  • 158