Arguments

Any new command you define may also have arguments. These arguments should be placed inside parentheses following the command name:

Define Command MyAdd($a, $b)

$sum = $a + $b

Return $sum

End

This new command adds two numbers together and returns the result of that calculation using the Return statement. When you use this new command, the variables $a and $b are assigned/defined while that command is active. You pass arguments to this command just as with other commands, eg:

$ten = MyAdd(6,4)

And like with other commands, you may use variables to pass arguments, eg:

$six = 6

$ten = MyAdd($six, 4)


Previous Chapter
Defining New Commands
<<  index  >>
 
Next Chapter
Variable Scope