Re: Pass by Reference
- Posted by petelomax Jan 13, 2015
- 2207 views
ghaberek said...
It seems like this might be a better syntax.
function foo(sequence this, integer update_value) integer prior_value = this[1] this[1] = update_value return (2){this, prior_value} end function
It can be read aloud as "return two values, this and prior_value."
Unfortunately the (round brackets) make it unnecessarily hard, since return (2) is a valid statement (and {this,prior} could be the start of a multiple assignment).
Just after you posted I suggested return[2] or return[2..8] (which could be read as "return at least two and at most eight values"), but I'll accept you pipped me to it.
Pete