Last active
August 29, 2015 14:26
-
-
Save 178inaba/94f8f32ce435a3c5f570 to your computer and use it in GitHub Desktop.
go is can not increment the array subscript
This file contains hidden or 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" | |
func main() { | |
var a [10]int | |
for i := 0; i < 10; { | |
//a[i++] = 1 | |
a[i] = 1 | |
i++ | |
fmt.Println(a) | |
} | |
} |
This file contains hidden or 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
[1 0 0 0 0 0 0 0 0 0] | |
[1 1 0 0 0 0 0 0 0 0] | |
[1 1 1 0 0 0 0 0 0 0] | |
[1 1 1 1 0 0 0 0 0 0] | |
[1 1 1 1 1 0 0 0 0 0] | |
[1 1 1 1 1 1 0 0 0 0] | |
[1 1 1 1 1 1 1 0 0 0] | |
[1 1 1 1 1 1 1 1 0 0] | |
[1 1 1 1 1 1 1 1 1 0] | |
[1 1 1 1 1 1 1 1 1 1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment