Program Editor (INPUT)
Console (Output)
Ready
a ← expression DISPLAY(expression) INPUT()
a + b a - b a * b a / b a MOD b
a = b a ≠ b a > b a < b a ≥ b a ≤ b NOT condition condition1 AND condition2 condition1 OR condition2
IF(condition)
{
<block of statements>
}
IF(condition)
{
<first block of statements>
}
ELSE
{
<second block of statements>
}
REPEAT n TIMES
{
<block of statements>
}
REPEAT UNTIL(condition)
{
<block of statements>
}
aList ← [value1, value2, value3]
aList[i] # 1-indexed!
x ← aList[i]
aList[i] ← x
INSERT(aList, i, value)
APPEND(aList, value)
REMOVE(aList, i)
LENGTH(aList)
FOR EACH item IN aList
{
<block of statements>
}
CONTAINS(text, substring) # Returns true/false
text[i] # 1-indexed character access
SUBSTRING(text, start, end) # 1-indexed, inclusive
LENGTH(text)
Example:
text ← "HELLO WORLD"
DISPLAY(text[1]) # "H"
DISPLAY(SUBSTRING(text, 1, 5)) # "HELLO"
IF(CONTAINS(text, "WORLD"))
{
DISPLAY("Found it!")
}
PROCEDURE procName(parameter1, parameter2, ...)
{
<block of statements>
RETURN(expression)
}
RANDOM(a, b) LENGTH(aList or text) CONTAINS(text, substring) SUBSTRING(text, start, end)