Operators

The operators are used to perform arithmetic operations and make comparisons between many things. The following operators are reserved by Go language.

Operators

Most commonly used operators are the arithmetic operators and comparators. Arithmetic operators are as following:

  • The + operator for sums
  • The - operator for subtractions
  • The * operator for multiplications
  • The / operator for divisions
  • The % operator for division remainders
  • The ++ operator to add 1 to the current variable
  • The -- operator to subtract 1 to the current variable

On the other side, comparators are used to check the differences between two statements:

  • The == operator to check if two values ...

Get Go: Design Patterns for Real-World Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.