Skip to content

Control Structures

EasyLang includes English-styled control flow: if, else, and two loop forms.


If / Else Example

we let score = 85

if score greater 90 then [
    so print "A"
] else if score greater 75 then [
    so print "B"
] else [
    so print "C or below"
]

Repeat-While Loop

we let x = 1

repeat while x less 5: do [
    so print x
    we let x = x plus 1
]

Output:

1
2
3
4

Repeat-From Loop (For Loop)

repeat from i = 1 to 5: do [
    so print i
]

Summary

  • if … then [ ]
  • else if
  • else
  • repeat while
  • repeat from