|
Purpose
|
Performs mathematical division on a variable.
|
|
Syntax
|
divide var {value}
var: The variable to be divided.
{value}: The amount to divide the variable by.
|
|
Notes
|
This command is used internally by the compiler to perform division. It can also be called manually.
Note that all decimal values will be truncated to the nearest whole number.
Another way to perform division is like this:
setVar $value ($value / 50)
|
|
Example
|
# calculate exactly how many trips we're making
# and how much we're carrying on our last trip
setVar $trips $quantity
divide $trips $holds
setVar $x $trips
multiply $x $holds
setVar $lastTrip $quantity
subtract $lastTrip $x
if ($lastTrip = 0)
setVar $lastTrip $holds
else
add $trips 1
end
|