golangUsing OR operator
package main
import (
"fmt"
)
func main() {
X := true
Y := false
xor := X || Y
}
ctrl + c
|| logical |
Usage example
package main
import (
"fmt"
)
func main() {
X := true
Y := false
fmt.Println(X || Y)
}
output
true
More of Golang
- How to sleep for 500 milliseconds
- How to iterate over a slice in reverse order
- How to do case-insensitive regexp
- Unrmarshal example
- How to write log to file
- Marshal example
- HTTP client example
- How to get JSON data from HTTP request
- How to generate random float
- How to generate random int
See more codes...