Returns control from a function to its calling function or from a child thread to its parent thread.
|expr||Optional: An expression whose value is returned to the calling function. The type of the value returned must match the declaration for the function.|
Use a return statement to return control from the function that currently has control to the function that called it. You can also use it to return a value to the calling function.
[-] testcase returnExample () [ ] INTEGER i [ ] i = 5 [ ] Print (Square (i)) [ ] i = -1 [ ] NonNegative (i) [ ] [-] INTEGER Square (INTEGER i) [ ] return i * i [ ] [-] void NonNegative (INTEGER i) [-] if (i < 0) [ ] return [-] else if (i == 0) [ ] Print ("i is zero") [-] else [ ] Print ("i =", i) [ ] // This script prints: 25