Go Arithmetic Operators
Arithmetic Operators
Arithmetic operators are used to perform common mathematical operations.
Operator | Name | Description | Example | Try it |
---|---|---|---|---|
+ | Addition | Adds together two values | x + y | Try it » |
- | Subtraction | Subtracts one value from another | x - y | Try it » |
* | Multiplication | Multiplies two values | x * y | Try it » |
/ | Division | Divides one value by another | x / y | Try it » |
% | Modulus | Returns the division remainder | x % y | Try it » |
++ | Increment | Increases the value of a variable by 1 | x++ | Try it » |
-- | Decrement | Decreases the value of a variable by 1 | x-- | Try it » |