Get Set Learn Go
Example demonstrates different comparison operators in Go. Comparison operators are used to evaluate values to boolean value of either true or false. Click here to learn more
func main() {
x := 3
y := 5
fmt.Println("x == y =", x == y)
fmt.Println("x != y =", x != y)
fmt.Println("x < y =", x < y)
fmt.Println("x > y =", x > y)
fmt.Println("x <= y =", x <= y)
fmt.Println("x >= y =", x >= y)
}
x == y = false
x != y = true
x < y = true
x > y = false
x <= y = true
x >= y = false
Try It Out | Source Code |
« Home Page | Previous « Boolean Expressions | Next » Math functions |