Propeller Manual

Table Of Contents
2: Spin Language Reference – Operators
Limit Minimum ‘#>’, ‘#>=
The Limit Minimum operator compares two values and returns the highest value. Limit
Minimum can be used in both variable and constant expressions. Example:
X := Y - 5 #> 100
The above example subtracts 5 from Y and limits the result to a minimum value to 100. If Y is
120 then 120 – 5 = 115; it is greater than 100 so
X is set to 115. If Y is 102 then 102 – 5 = 97;
it is less than 100 so
X is set to 100 instead.
Limit Minimum has an assignment form,
#>=, that uses the variable to its left as both the first
operand and the result destination. For example,
X #>= 50 'Short form of X := X #> 50
Here, the value of X is limited to a minimum value of 50 and the result is stored back in X.
The assignment form of Limit Minimum may also be used within expressions for
intermediate results; see Intermediate Assignments, page 147.
Limit Maximum ‘
<#’, ‘<#=
The Limit Maximum operator compares two values and returns the lowest value. Limit
Maximum can be used in both variable and constant expressions. Example:
X := Y + 21 <# 250
The above example adds 21 to Y and limits the result to a maximum value to 250. If Y is 200
then 200 + 21 = 221; it is less than 250 so
X is set to 221. If Y is 240 then 240 + 21 = 261; it is
greater than 250 so
X is set to 250 instead.
Limit Maximum has an assignment form,
<#=, that uses the variable to its left as both the first
operand and the result destination. For example,
X <#= 50 'Short form of X := X <# 50
Here, the value of X is limited to a maximum value of 50 and the result is stored back in X.
The assignment form of Limit Minimum may also be used within expressions for
intermediate results; see Intermediate Assignments, page 147.
Propeller Manual v1.1 · Page 155