Last active
August 29, 2015 14:13
-
-
Save sugilog/e4e423597709c01155f2 to your computer and use it in GitHub Desktop.
iota
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" | |
const ( | |
flag0 = iota | |
flag1 | |
flag2 | |
flag3 | |
) | |
const ( | |
flagA0 = iota << 1 | |
flagA1 | |
flagA2 | |
flagA3 | |
flagB0 = iota << 1 | |
flagB1 | |
flagB2 | |
flagB3 | |
) | |
const ( | |
flagC0 = 1 << iota | |
flagC1 | |
flagC2 | |
flagC3 | |
) | |
func main() { | |
fmt.Println( flag0 ) | |
fmt.Println( flag1 ) | |
fmt.Println( flag2 ) | |
fmt.Println( flag3 ) | |
fmt.Println( flagA0 ) | |
fmt.Println( flagA1 ) | |
fmt.Println( flagA2 ) | |
fmt.Println( flagA3 ) | |
fmt.Println( flagB0 ) | |
fmt.Println( flagB1 ) | |
fmt.Println( flagB2 ) | |
fmt.Println( flagB3 ) | |
fmt.Println( flagC0 ) | |
fmt.Println( flagC1 ) | |
fmt.Println( flagC2 ) | |
fmt.Println( flagC3 ) | |
ioty() | |
} | |
func ioty() { | |
// flagy0 := iota | |
// fmt.Println( flagy0 ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment