Skip to content

Instantly share code, notes, and snippets.

@pine
Last active December 3, 2015 15:46
Show Gist options
  • Save pine/b5fe2cb3788dbbe232c0 to your computer and use it in GitHub Desktop.
Save pine/b5fe2cb3788dbbe232c0 to your computer and use it in GitHub Desktop.
NestedArray.cr
alias Type = Int32 | String | Array(Type)
foo = Array(Type).new
foo.push(1)
foo.push("foo")
foo.push([ 1, 2, "foo" ] of Type)
foo.push([ 1, 2, [ 3, 4, "foo" ] of Type] of Type)
p foo
# => [1, "foo", [1, 2, "foo"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment