Return multiple values: Difference between revisions

Line 1,481:
<lang visualfoxpro>FUNCTION Addsub( x, y )
RETURN { x + y, x - y }</lang>
However, we can 'return' multiple individual values, that are produced/processed/altered inside a function, indirectly, passing parameters `by reference`.
For example:
 
<lang visualfoxpro>
PROCEDURE Main()
LOCAL Street, City, Country
IF GetAddress( @Street, @City, @Country )
? hb_StrFormat( "Adrress: %s, %s, %s", Street, City, Country )
// output: Route 42, Android-Free Town, FOSSLAND
ELSE
? "Cannot obtain address!"
ENDIF
FUNCTION GetAddress( cS, cC, cCn)
cS := "Route 42"
cC := "Android-Free Town"
cCn:= "FOSSLAND"
RETURN .T.
 
=={{header|Haskell}}==
Anonymous user