Skip to content

Instantly share code, notes, and snippets.

@jots
Created May 6, 2014 00:50
Show Gist options
  • Save jots/11550953 to your computer and use it in GitHub Desktop.
Save jots/11550953 to your computer and use it in GitHub Desktop.
var buckets: array[0..9, string]
# initialize. wish they were automagically initialized
for i in 0..buckets.high: buckets[i] = ""
# XXX not work
for i in 0..1:
for buck in buckets:
# following line doesn't work. compile error:
# Error: for a 'var' type a variable needs to be passed
#buck &= "test"
# works.
for i in 0..1:
for x in 0..buckets.high:
buckets[x] &= "appending: " & $x
for x in 0..buckets.high:
echo buckets[x]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment