Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operators

Romit accepts symbols and words for arithmetic and comparisons everywhere in scripts (including function bodies, conditions, and the playground). Parentheses are not available for grouping—use a temporary variable when precedence is not what you want.

Arithmetic

MeaningSymbolsWords
add+plus
subtract-minus
multiply*times
divide/divided by
remainder%remainder

Examples:

set x to a+b
set y to a plus b
set m to 10 remainder 3

Precedence is familiar: * / % bind tighter than + / -. Without parentheses, split sub-expressions into variables:

set step1 to a plus b
set step2 to step1 times c

Comparisons

SymbolsWords
==is
!=is not
<is below, is less than, below
>is above, is more than, above
<=is at most
>=is at least

Examples:

if n is below 2
  give 1
if score>=80
  say "high"

The spec-layer parser accepts the same aliases in handler conditions and tests.