Created
February 26, 2017 13:23
-
-
Save ro6/325f3d9013ab57b43cd760798d0a4dee to your computer and use it in GitHub Desktop.
Trying to create an empty array with space for at least 1 element, add an element at position 0, then retrieve the element
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
actor Main | |
new create(env: Env) => | |
let arr: Array[Bool] = Array[Bool](1) | |
try | |
arr(0) = true | |
env.out.print(arr(0).string()) | |
else | |
env.out.print("fail") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What you are looking for in this case is...
If you note from the Array constructor...
And from update that you were trying to use
If you were using numbers, you could use
undefined
but that isn't.From a type perspective, the Bool or None that I use is what you are trying to define here.