|
EndFunction | ||
Function <.FuncName.>[(ParamList)] ... [ExitFunction] ... EndFunction | ||
Parameters: NONE | ||
Returns: NONE | ||
Functions can be called from different locations in a program. A function is a routine that returns a value after it executes. For example: calls MyFunction and assigns the result to I. Function calls cannot appear on the left side of an assignment statement. Functions that don't return a value can be used as complete statements. For example, calls the MyOtherFuntion routine. Functions can call themselves recursively. A function is declared with the Function keyword, followed by the function name and a list of optional parameters (seperated my commas). The function ends with the EndFunction statement that can be followed by a value or expression that will be returned. With ExitFunction you can exit a function anywhere in the function block. FACTS: * To return information from a function, the variables & arrays need to be listed after the EndFunction statement. ie. EndFUnction Result would return the value of the Result variable back to the caller. * For style reasons, Function declaration keywords (Function & EndFunction) can not be indented. * Values or expressions that follow EndFunction and ExitFunction must be of the same type. * You can return multiple values from a function. * Need more information on functions ? See the Functions&Psub tutorial. Also, See the ArrayBasics, Types tutorials for passing arrays & types. Mini Tutorial: The follow code contains variable example functions. We have a function that doesn't
This example would output.
|
Related Info: | EndPsub | ExitFunction | Function | Functions&Psub | Psub : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |