There is no Operator Precedence Table for the Golang language in the help. Please I want a painting like this. Please Write all Operators in order of priority. Please list all Operators in order of priority. This is the deficiency.|
From the spec:
Operator precedence
Unary operators have the highest precedence. As the ++ and – operators form statements, not expressions, they fall outside the operator hierarchy. As a consequence, statement *p++ is the same as (*p)++.
There are five precedence levels for binary operators. Multiplication operators bind strongest, followed by addition operators, comparison operators, && (logical AND), and finally || (logical OR):
Precedence Operator 5 * / % << >> & &^ 4 + - | ^ 3 == != < <= > >= 2 && 1 ||
Binary operators of the same precedence associate from left to right. For instance, x / y * z is the same as (x / y) * z.
+x // x 42 + a - b // (42 + a) - b 23 + 3*x[i] // 23 + (3 * x[i]) x <= f() // x <= f() ^a >> b // (^a) >> b f() || g() // f() || g() x == y+1 && <-chanInt > 0 // (x == (y+1)) && ((<-chanInt) > 0)
1 Like
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.