Advertisement
cwchen

[Go] Array declaration, short form.

Sep 20th, 2017
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.17 KB | None | 0 0
  1. package main
  2.  
  3. import "log"
  4.  
  5. func main() {
  6.     langs := [4]string{
  7.         "Go",
  8.         "Python",
  9.         "Ruby",
  10.         "PHP",
  11.     }
  12.  
  13.     if !(langs[0] == "Go") {
  14.         log.Fatal("Wrong string")
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement