Advertisement
cwchen

[Go] Logic operators

Sep 9th, 2017
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.37 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.     // AND (&&)
  9.     fmt.Println(true && true)
  10.     fmt.Println(true && false)
  11.     fmt.Println(false && true)
  12.     fmt.Println(false && false)
  13.  
  14.     // OR (||)
  15.     fmt.Println(true || true)
  16.     fmt.Println(true || false)
  17.     fmt.Println(false || true)
  18.     fmt.Println(false || false)
  19.  
  20.     // NOT (!)
  21.     fmt.Println(!true)
  22.     fmt.Println(!false)
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement