Advertisement
cwchen

[Go] if ... else if ... else demo

Sep 14th, 2017
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.23 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.     n := 0
  9.  
  10.     if n > 0 {
  11.         fmt.Println("n is larger than zero.")
  12.     } else if n < 0 {
  13.         fmt.Println("n is smaller than zero.")
  14.     } else {
  15.         fmt.Println("n is equal to zero.")
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement