Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. // The var statement declares a list of variables; as in function argument lists, the type is last.
  2. // A var statement can be at package or function level. We see both in this example.
  3. package main
  4.  
  5. import "fmt"
  6.  
  7. // A var declaration can include initializers, one per variable.
  8. var i, j int = 1, 2
  9.  
  10. var c, python, java bool
  11.  
  12. func main() {
  13. var i int
  14. // Inside a function, the := short assignment statement can be used in place of a var declaration with implicit type.
  15. // Outside a function, every statement begins with a keyword (var, func, and so on) and so the := construct is not available.
  16. k := 3
  17. fmt.Println(i, c, python, java)
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement