yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Yorick Language Reference

Arithmetic and Comparison Operators

From highest to lowest precedence,

^          raise to power
* / %      multiply, divide, modulo
+ -        add, subtract (also unary plus, minus)
<< >>      shift left, shift right
>= < <= >  (not) less, (not) greater (int result)
== !=      equal, not equal (int result)
&          bitwise and
~          bitwise xor (also unary bitwise complement)
|          bitwise or
=          redefine or assign

Any binary operator may be prefixed to = to produce an increment operator; thus x*=5 is equivalent to x=x*5. Also, ++x and --x are equivalent to x+=1 and x-=1, respectively. Finally, x++ and x-- increment or decrement x by 1, but return the value of x before the operation.