Last active
December 13, 2015 19:19
-
-
Save PhilipWitte/4962255 to your computer and use it in GitHub Desktop.
dynamic array problem
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
func main() | |
{ | |
var nums = text[] # a dynamic array | |
ref n : text # a 'int' reference | |
nums += "foo" # add "foo" | |
nums += "bar" # add "bar" | |
nums += "baz" # add "baz" | |
n => nums[1] # 'n' refers to 'num[1]' | |
if RUNTIME_CONDITION | |
{ | |
nums -= nums[1] # remove 'nums[1]' from 'nums' | |
} | |
assert(n == nil) # ?? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment