Define a user function.
Syntax:
Function functionName([parameters])
[statements]
End Function return list
| parameters | Optional. A comma seperated list of parameter variable definitions |
| statements | Optional. Statements that make up the function definition |
| return list | Required. A list of one or more variables to return separated with a comma |
Example:
Sub test() Dim x as uByte x=22 x=max(x,50) ' x will now be 50 End Sub ' return the greatest of two ubyte values Function max(a As uByte,b As uByte) Dim r As uByte r=a If b>a Then: r=b: End If End Function r
Also See: Exit Function