↑ Up |
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,
| 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,
| less than, greater than, less than or equal to, greater than or equal to | left |
11 | a==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 |
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.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)
Keyword | Meaning |
---|---|
and | logical operator |
assert | assert a logical expression |
begin | a code block |
break | leave a loop |
catch | catch an exception |
continue | jump to the begin of a loop |
do | separates a condition from a loop body |
elif | else if |
else | else case |
end | end of a statement |
false | literal of a logical value |
for | for loop statement |
fn | function expression |
function | function statement |
global | declare a variable to be global |
goto | jump statement |
if | conditional statement |
in | membership operator |
is | is-the-same-object-as operator |
label | jump label |
null | literal of the null object |
not | logical operator |
or | logical operator |
public | public variable |
raise | raise an exception |
return | return from a subroutine |
table | literal of a table object |
then | separates a condition from conditional statments |
true | literal of a logical value |
try | exception handling may occur |
use | import a module |
while | while loop statement |
yield | return from a coroutine |