Lessthanorequal
Lessthanorequal, <=, is an inequality operator to test whether the value on the left is less than, or equal to, the value on the right.
Availability  Present in all original versions of BBC BASIC.  
Syntax  BASIC IV  <numvar> = <numeric> <= <numeric><numvar> = <string> <= <string>

Token (hex)  BASIC IV  3C 3D (operator)

Description  BASIC IV  Compares the values of the two operands and returns TRUE if they are equal, or if the lefthand operand is less than the right, and FALSE otherwise.

Associated keywords  = , < , > , >= , <>

Description
<=
evaluates the expressions on either side, and compares their values. If the values are equal, or if the value on the left is less than the one on the right, it returns the Boolean value TRUE
, otherwise it returns FALSE
. It is usually used as the condition of an IF
statement, but it is equally valid to assign the result to a variable.
The symbol is an ASCII substitute for ≤. The <
comes first so that the =
is not misinterpreted as an assignment statement (see =
).
One numeric variable is less than another if it is nearer to negative infinity. If both numbers are negative, the one with the larger magnitude is less. For the definition of 'lessthan' on strings, please see String collation.
It is not possible to daisychain (in)equality tests (for example IF bool% <= X = Y THEN ...
), as the Group 5 operators do not associate. Please see =
for more details.
Due to the numerical values of TRUE
and FALSE
in BBC BASIC, >=
is, for these values, identical to A OR NOT B
:
A  B  A <= B


FALSE 
FALSE 
TRUE

FALSE 
TRUE 
FALSE

TRUE 
FALSE 
TRUE

TRUE 
TRUE 
TRUE

 beardo 23:23, 13 June 2007 (BST)