Out (keyword)

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.



The out keyword causes arguments to be passed into method by reference. Similar to var, but it does not need to be initialized by the caller.

Example

method Method1(out i: Integer);
begin
  i := 44;
end;

method Method2;
begin
  var value: Integer;
  Method1(out value);
  // value is now 44
end;

The .NET runtime does not really support out params though, so when you define them in Delphi Prism (or C#) they are really just var parameters with that attribute. The compiler doesn't really treat the [Out] attribute as special, but just uses it when it finds the out keyword.


See Also


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox