Web Turtle - "IF...ELSE...ENDIF" Example

This is a simple "IF...ENDIF" structure. Depending on the value of the variable "A", the "PRINT" command may or may not be executed...

IF A < 10
  PRINT A is less than 10
ENDIF
And here is a similar "IF...ELSE...ENDIF" structure...

IF A < 10
  PRINT A is less than 10
ELSE
  PRINT A is greater than or equal to 10
ENDIF
You can of course nest "IF"s...

IF A < 10
  IF A < 5
    PRINT A is less than 5
  ELSE
    PRINT A is either 5, 6, 7, 8 or 9...
  ENDIF
ELSE
  PRINT A is greater than or equal to 10
ENDIF
(Enter a number: )

"Web Turtle," created by Bill Kendrick, 1997-2017.