-
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 * 4
returns 12 -
4 / 2
returns 2 -
1 + 1
returns 2 -
3 - 4
returns -1 -
10 % 7
returns 3 -
10 % 3
returns 1 -
10 // 7
returns 1 -
10 // 3
returns 3 -
5 ^ 2
returns 25 -
62 & 35
returns 34 -
~1
returns -2 and~-2
returns 1 -
5 + 5 * 3 + 2
returns 22 -
(5 + 5) * (3 + 2)
returns 50