Quick reference

Table of contents

  1. Operator precedence table
  2. Data types
  3. Keywords

Operator precedence table

Level Operators Meaning Associativity
1 f(a), a[k] function application,
indexing
left
2 a^b power right
3 -a, ~a, *a negation, complement,
list unpacking
right
4 a*b, a/b,
a//b, a%b
multiplication, division,
integer division, modulo
left
5 a+b, a-b addition, subtraction left
6 a>>b, a<<b right shift, left shift left
7 a&b bitwise and left
8 a|b, a$b bitwise or,
bitwise exclusive or
left
9 a..b range left
10 a<b, a>b,
a<=b, a>=b
less than, greater than,
less than or equal to,
greater than or equal to
left
11 a==b, a!=b
a is b,
a is not b,
a in b,
a not in b,
a: b
equal to, not equal to,
is the same object as,
is not the same object as,
membership,
type test
left
12 not a logical negation right
13 a and b conjunction left
14 a or b disjunction left
15 a if c else b conditional expression right

Data types

Bool, Int, Long, Float, Complex, List, Map,
Range, Iterable, Function, Type

List
  a+b, n*a, a^n, a==b, a<b, a<=b,
  a.append(b), a.chain(), a.clear(), a.filter(p),
  a.insert(i,x), a.map(f), a.plus(x), a.pop(), a.push(x),
  a.rev(), a.shuffle(), a.swap(i,j)

Map
  a&b, a|b, a-b, a$b, a==b,
  m.add(x), m.clear(), m.extend(m2), m.items(),
  m.remove(), m.update(), m.values()

Iterable
  a.all(p), a.any(p), a.chunks(n), a.count(), a.count(p),
  a.each(f), a.enum(), a.filter(p), a.join(), a.join(sep),
  a.join(sep,left,right), a.list(), a.list(n), a.map(f),
  a.prod(), a.prod(f), a.reduce(f), a.reduce(e,f),
  a.skip(n), a.sort(), a.sort(p), a.sum(), a.sum(f),
  a.take(n), a.until(p)

Function
  f^n, f.argc(), f.orbit(x)

Keywords

KeywordMeaning
andlogical operator
assertassert a logical expression
begina code block
breakleave a loop
catchcatch an exception
continuejump to the begin of a loop
doseparates a condition from a loop body
elifelse if
elseelse case
endend of a statement
falseliteral of a logical value
forfor loop statement
fnfunction expression
functionfunction statement
globaldeclare a variable to be global
gotojump statement
ifconditional statement
inmembership operator
isis-the-same-object-as operator
labeljump label
nullliteral of the null object
notlogical operator
orlogical operator
publicpublic variable
raiseraise an exception
returnreturn from a subroutine
tableliteral of a table object
thenseparates a condition from conditional statments
trueliteral of a logical value
tryexception handling may occur
useimport a module
whilewhile loop statement
yieldreturn from a coroutine