Recent Changes - Search:
Email iofreak@yahoo.com with comments and/or suggestions.

Aibo General

Aibo Development

Wiki Help

Aibo Links

R-Code » IF

IF...THEN...ELSE Statement

Evaluates an expression and performs processing according to the results.

Models

ERS-210 ERS-220 ERS-31x ERS-7

Syntax

(Format 1) IF:val1:op:val2:THEN
...
[ELSE
...]
ENDIF

(Format 2) IF:val1:op:val2:CALL:label[:argc]

(Format 3) IF:val1:op:val2:BREAK

(Format 4) IF:val1:op:val2:then[:else]

The IF...THEN...ELSE statement syntax has the following parts:

PartDescription
val1Variable or constant.
opA valid boolean operator (=, ==, <>, !=, <, <=, >, >=, &, |, ^, &&, ||).
val2Variable or constant.
labelSubroutine label.
argcOptional. Number of subroutine arguments.
thenJump destination if condition satisfied.
elseOptional. Jump destination if condition not satisfied.

Example(s)


   IF:x:=:0:THEN
      PRINT:"x is 0"
   ELSE
      PRINT:"x is not 0"
   ENDIF
 

Remarks

Format 1: If expression is true, execute THEN Block. If expression is false, execute ELSE Block. The ELSE Block can be omitted, but always be sure to terminate with ENDIF.

Format 2: If expression is true, CALL function.

Format 3: If expression is true, execute BREAK. Use to break out of loops.

Format 4: If expression is true, GO to one label. If expression is false, GO to another label. Avoid this format as much as possible.

Edit - History - Print - Recent Changes - Search - Site Terms of Use
Page last modified on April 27, 2006, at 04:18 PM CST