if 1<2 then 5 else 6;Hope replies:
>> 5 : num
Now try:
if 1>2 then 5 else 6;This time Hope replies:
>> 6 : numThese are conditional expressions. Hope first evaluates the boolean expression after the key word
if
. If it evaluates to true
, Hope goes on to evaluate the then
expression. If it evaluates to false
, then Hope evaluates the else
expression.