Values can be tested using five basic
Notice that the
is operator is not written
= is used to set variables, not test values:
if x is 6 write 'x is 6' else write 'x isnt 6'
If the program had been written with
= instead of
it would have set
x to 6 instead of testing it.
The less-than operator
< and greater-than operator
test for values that are unequal:
if 3 < PI write '3 is less than PI'
The less-than-or-equal-to operator
<= and greater-than-or-equal-to
>= also allow values to be equal:
if x >= 25 write 'no less than 25'
Words or other strings of characters can be compared. They are compared according to their unicode values, which is similar to alphabetic order, but capital letters all come before lowercase letters, and numbers and other symbols also have a specific order.
a = "apple" b = "apricot" if a < b write a, 'then', b else write a, 'after', b