-
Notifications
You must be signed in to change notification settings - Fork 1
Mathematical operators
Jean Dubois edited this page May 20, 2024
·
8 revisions
Here are the mathematical operators avaible in Nougaro (ordered by priority) :
| Nougaro | Python | Comments |
|---|---|---|
| ^ | ** | power |
| * | * | multiplication |
| % | % | modulo |
| / | / | division |
| // | // | floor division |
| + | + | addition |
| - | - | substraction |
| & | & | bitwise 'and' |
| | | | | bitwise 'or' |
| ^^ | ^ | bitwise 'xor' |
| ~ | ~ | bitwise 'not' |
It respects operation priority and you can use parenthesis.
-
3 * 4returns 12 -
4 / 2returns 2 -
1 + 1returns 2 -
3 - 4returns -1 -
10 % 7returns 3 -
10 % 3returns 1 -
10 // 7returns 1 -
10 // 3returns 3 -
5 ^ 2returns 25 -
62 & 35returns 34 -
~1returns -2 and~-2returns 1 -
5 + 5 * 3 + 2returns 22 -
(5 + 5) * (3 + 2)returns 50