Tymless Tutorial: Reference



   
  < operators

Operator Precedence

 
 

Drawing

Control

Data

Reference

 

When an expression contains more than one operation, they are performed in order of operator precedence. This is a natural approach, mimicking the way maths is written and ideas are spoken. For example the quadratic equation,

y = 3x2 + 2x - 1

becomes

y = 3*x**2 + 2*x - 1

instead of

y = 3*(x**2) + (2*x) - 1

and the expression,

A greater than 5 and B less than 10

becomes

A gt 5 and B lt 10

instead of

(A gt 5) and (B lt 10)

On average, operator precedence doesn't let us write more succinct code, just more natural code.

This table shows the operators in descending order of precedence. E.g. the operators on the first line will be performed before those on the second. If two operators have the same precedence, the first to be encountered in the expression takes priority.

**, log, max, min, transform, strleft, strright
*, /, mod
+, -
by
rotate
eq, ne, gt, ge, lt, le
and
or
, (comma)

 

   
  < operators