Return multiple values: Difference between revisions

No edit summary
Line 1,887:
Functions can be made in 5 ways: Normal, Lambda, Simple, Group which return value, Pointer to Group which return value. For every way we can return multiple values as tuple (in a mArray type of array). The (a,b)=funcA() is a way to define/assign values from tuple. So (a,b)=(1, 2) is the simple form. A return value from a function done using = as statement. This return isn't the last statement (isn't exit from function), so may we have multiple = as statements and the last one which we execute return the value. By default if we don't use the = statement based on function's suffix at name (at call) we get 0 or "". Functions can return any type of types. So the return type based on statement = (or the interpreter return 0 or "" based on name at call, where suffix $ means we return empty string, although later versions of language can return string/ make string variables without suffix $).
 
<syntaxhighlight lang="m2000 interpreter">
 
 
<lang M2000 Interpreter>
module Return_multiple_values{
Print "Using a function"
Line 2,044 ⟶ 2,042:
Return_multiple_values
Print "Done"
</syntaxhighlight>
</lang>
 
=={{header|Maple}}==
404

edits