12345678910111213141516 |
- // Variables with initializers
- package examples
- import "fmt"
- // A var declaration can include initializers, one per variable.
- var i, j int = 1, 2
- // VarsWitInit: If an initializer is present, the type can be
- // omitted; the variable will take the type of the initializer.
- func VarsWithInit() (int, int, bool, bool, string) {
- var c, python, java = true, false, "No!"
- fmt.Println(i, j, c, python, java)
- return i, j, c, python, java
- }
|