daily pastebin goal
43%
SHARE
TWEET

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

cwchen Sep 14th, 2017 (edited) 288 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top