Created
February 16, 2010 12:04
-
-
Save nddrylliog/305480 to your computer and use it in GitHub Desktop.
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
import structs/Array | |
main: func { | |
size := 12 | |
arr := Array<Int> new(size) | |
for(i in 0..size / 2) { | |
arr set(i, i + 1) | |
} | |
for(i in 0..size) { | |
arr[i] = i + 1 | |
} | |
for(i in 0..size) { | |
printf("%d, ", arr get(i)) | |
} | |
println() | |
for(i in 0..size) { | |
printf("%d, ", arr[i]) | |
} | |
println() | |
i := 0 | |
iter := arr iterator() | |
while(iter hasNext()) { | |
printf("%d, ", iter next()) | |
i += 1 | |
} | |
println() | |
for(i in arr) { | |
printf("%d, ", i) | |
} | |
println() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment