There are two values having mode BOOL
. Operators with
operands of mode BOOL
are predeclared in the standard
prelude. A conditional clause uses an enquiry clause yielding a value
of mode BOOL
. A case clause uses an enquiry clause
yielding a value of mode INT
. Both conditional and case
clauses can be abbreviated. Extended conditional and case clauses can
be written using ELIF
and OUSE
respectively.
Conditional clauses and case clauses are sometimes grouped together
and termed choice clauses. Choice clauses are examples of enclosed
clauses, and are units.
Here are some exercises which test you on the material covered in this chapter.
BOOL
? Ans3 < 4
4.0 >= 0.4e1
2 < 3 & 3 > 2
11 < 2 OR 10 < ABS TRUE
NOT TRUE & ABS "A" < ABS "D"
NOT(3 > 2 & 3 > 1 OR 10 < 6)
m
is predeclared):
IF m>4|print("ok")ELSE print(".")ESACAns
FOR i TO 10 DO print(ODD i) ODAns
"Units"
if m
(which has mode INT
) is less than 10
, "Tens"
if
it is less than 100
, "Hundreds"
if it is less
than 1000
and "Too big"
otherwise. Ans"Queen"
.
Ans