Go Operators

Arithmetic Operators

+   Addition        a + b
-   Subtraction     a - b
*   Multiplication  a * b
/   Division        a / b
%   Modulus         a % b

Used with numeric types like int, float64.

Comparison Operators

==  Equal to
!=  Not equal to
>   Greater than
<   Less than
>=  Greater than or equal to
<=  Less than or equal to

Used in conditionals to compare values.

Logical Operators

&&  Logical AND
||  Logical OR
!   Logical NOT

Used with boolean expressions (e.g., in if or for loops).

age := 25
if age > 18 && age < 65 {
    fmt.Println("Adult")
}

Assignment Operators

=    Assign
+=   Add and assign
-=   Subtract and assign
*=   Multiply and assign
/=   Divide and assign
%=   Modulus and assign
x := 10
x += 5  // x = 15

Bitwise Operators

Operate at the bit level, mostly used in systems programming:

&   AND
|   OR
^   XOR
&^  AND NOT
<<  Left shift
>>  Right shift
Loading...
Output:

Type-Specific Behavior

String concatenation uses +:

Loading...
Output:

Booleans support &&, ||, ! only.

Need Help?

Ask the AI if you need help understanding or want to dive deeper in any topic