Value types (structures and enumerations) are passed by value to functions: a copy will be given to the function, not a reference to the variable. So the following function won't do anything.
void add_three (int x) {
x += 3;
}
int a = 39;
add_three (a);
assert (a == 39); // a is still 39
To change this behavior you can use the ref
keyword.
// Add it to the function declaration
void add_three (ref int x) {
x += 3;
}
int a = 39;
add_three (ref a); // And when you call it
assert (a == 42); // It works!
out
works the same way, but you are forced to set a value to this variable before the end of the function.
string content;
FileUtils.get_contents ("file.txt", out content);
// OK even if content was not initialized, because
// we are sure that it got a value in the function above.
print (content);