1.80 class if

An if object is a conditional statement. When executed, it will execute the if<-condition. On success, it will execute the if<-then branch, otherwise it will execute the if<-else branch. An empty if<-then or if<-else (@nil) simply succeeds.

A special trick is to use if(<Statement>). This will succeed regardless of the success or failure of <Statement>.

The following example exploits the if object to remove all graphicals with area<-measure from Device:

send(Device?graphicals, for_all,
         if(@arg1?area?measure == 0,
            message(@arg1, free)))

Class when implements the function equivalent of class if.

See also
class when

1.80.1 Instance variables

if <-> condition: code
Condition to be tested. Note that, if this is a function object, it tests whether the function returns a value. See also code->execute.
if <-> else: code*
Branch of the conditional statement. if<-then is executed on successful execution of if<-condition, if<-else otherwise. If the statement is @nil, it executes successfully without side-effects. If the statement is a function, it will be executed as defined by code->execute.
if <-> then: code*
Inherits description from: if-else