### Basic Operators

- An
`operator`

is a special symbol or a phrase that you use to check, change or combine values. - Operators are unary, binary or ternary.
`Unary`

operators operate on a single target.`-a`

`!b`

`c!`

`a++`

`Binary`

operators operate on two targets.`2 + 3`

`a * b`

`c - d`

`Ternary`

operators operate on three targets.- Conditional operator -
`(isValid == TRUE) ? b : c`

- Conditional operator -

#### Assignment Operator

let b = 10 // b has value 10 now var a = 5 // a has 5 a = b // a has 10

Assigning value to tuple

let (x, y) = (1, 2) // x has 1 & y has 2

#### Arithmetic Operators

- Addition (
`+`

) - Subtraction (
`-`

) - Multiplication (
`*`

) - Division (
`/`

) - Remainder (
`%`

) - Compound Assignment Operators (
`+=`

)

1 + 2 // equals 3 5 - 3 // equals 2 2 * 3 // equals 6 10.0 / 2.5 // equals 4.0 "Hello" + " world" // equals `Hello world` 9 % 4 // equals 1 -9 % 4 // equals -1 var a = 1 a += 2 // a is now equal to 3

#### Comparison Operators

- Equal to (
`a == b`

) - Not equal to (
`a != b`

) - Greater than (
`a > b`

) - Less than (
`a < b`

) - Greater than or equal to (
`a >= b`

) - Less than or equal to (
`a <= b`

)

You must log in to post a comment.