Operators
Explore the different types of operators in Go, including arithmetic, logical, and bitwise operations. Understand how each operator works with various data types, their precedence rules, and usage restrictions to write clear and correct Go code.
We'll cover the following...
We'll cover the following...
Introduction
A symbol that is used to perform logical or mathematical tasks is called an operator. Go provides the following built-in operators:
- Arithmetic operators
- Logical operators
- Bitwise operators
Arithmetic operators
The common binary operators +, -, * and / that exist for both integers and floats in Golang are:
- Addition operator
+ - Subtraction operator
- - Division operator
/ - Modulus operator
% - Multiplication operator
*
The + operator also exists for strings. The / operator for integers is (floored) integral division. For example, will give you ...