Last active
September 17, 2017 18:27
-
-
Save R4wm/dc992645cf2201d3ac47a901ded04fbc to your computer and use it in GitHub Desktop.
iota example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
//using iota to declare value and inc | |
const ( | |
A1 = iota //Start at 0 | |
B1 = iota //Inc by 1 | |
C1 = iota //Inc by 1 | |
) | |
const ( | |
A2 = iota //Start at 0 | |
B2 //Inc by 1 | |
C2 //Inc by 1 | |
) | |
const ( | |
A3 = iota + 3 //Start at 3 | |
B3 //Inc by 1 | |
C3 //Inc by 1 | |
) | |
func main() { | |
println("print first example:") | |
fmt.Printf("A1: %d\nB1: %d\nC1: %d\n", A1, B1, C1) | |
println("print second example") | |
fmt.Printf("A2: %d\nB2: %d\nC2: %d\n", A2, B2, C2) | |
println("print third example (starting at 3)") | |
fmt.Printf("A3: %d\nB3: %d\nC3: %d\n", A3, B3, C3) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment