Dinfio Documentation
Operator is the symbol used for changing, combining, and comparing values.
Dinfio supports unary operators and binary operators. Unary operators are operators that operate on a single value, i.e. -a
(minus), !a
(not).
And binary operators are operators that operate on two values, i.e. a + b
(addition).
Dinfio divides operators into the following groups:
Operator | Name | Example | Result |
---|---|---|---|
+ | Addition | 5 + 2 | 7 |
- | Subtraction | 5 - 2 | 3 |
* | Multiplication | 5 * 2 | 10 |
/ | Division | 5 / 2 | 2.5 |
\ | Integer Division | 5 \ 2 | 2 |
% | Modulus | 5 % 2 | 1 |
^ | Exponentiation | 5 ^ 2 | 25 |
& | Concatenation | "Hello " & "world" | "Hello world" |
Assignment | Equivalent To | Example | Result |
---|---|---|---|
a = b | No equivalent | a = 1 | a equals to 1 |
a += b | a = a + b | a = 1; a += 2 | a is now equal to 3 |
a -= b | a = a - b | a = 3; a -= 2 | a is now equal to 1 |
a *= b | a = a * b | a = 3; a *= 2 | a is now equal to 6 |
a /= b | a = a / b | a = 3; a /= 2 | a is now equal to 1.5 |
a \= b | a = a \ b | a = 3; a \= 2 | a is now equal to 1 |
a %= b | a = a % b | a = 3; a %= 2 | a is now equal to 1 |
a &= b | a = a & b | a = "Clara"; a &= "Aisha" | a is now equal to "ClaraAisha" |
Operator | Name | Example | Result |
---|---|---|---|
== | Equal to | 5 == 5 | true |
!= | Not equal to | 5 != 5 | false |
> | Greater than | 5 > 2 | true |
< | Less than | 5 < 2 | false |
>= | Greater than or equal to | 5 >= 2 | true |
<= | Less than or equal to | 5 <= 5 | true |
Operator | Name | Example | Result |
---|---|---|---|
! | Logical NOT | !true | false |
&& | Logical AND | true && false | false |
|| | Logical OR | true || false | true |
^^ | Logical XOR | true ^^ false | true |
← Data Types and Variables | Index | Control Flows → |
Documentation version: 1.0.14. Updated on: 22 August 2024.
Dinfio is designed and written by Muhammad Faruq Nuruddinsyah. Copyright © 2014-2025. All rights reserved.