-
Notifications
You must be signed in to change notification settings - Fork 1
Operators
Frederik Tobner edited this page Apr 29, 2023
·
7 revisions
| Operator | Description |
|---|---|
| = | simple assignment operator. Used to assign a value to a variable |
| += | adds the second number two the first number and stores the result in the first number |
| -= | subtracts the second number from the first and stores the result in the first number |
| *= | multiplys two numbers and stores the result in the first number |
| /= | divides the first number with the second number and stores the result in the first number |
| %= | gets the remainder of the division of the first number with the second number and stores the result in the first number |
| **= | raises the first with the second numberand stores the result in the first number |
| Operator | Description |
|---|---|
| + | adds two numbers or concatinates two strings |
| - | subtracts the second number from the first |
| * | multiplys two numbers |
| / | divides the first number with the second number |
| % | gets the remainder of the division of the first number with the second number |
| ** | raises the first with the second number |
| [ ] | Index operator, gets the character at the specified position in an array or string |
| .. | Used within an index operator, to create a slice from an already existing array or string |
| Operator | Description |
|---|---|
| and && |
returns true if both values are truthy |
| or || |
returns true if at least one of the values is truthy |
| Operator | Description |
|---|---|
| ! | Converts avalue from a truthy value to a falsy value and vice versa |
| - | Negates a numerical value |