P
Pieter Mans
I'm trying to create a map datatype (a glorified matrix, really). It
basically works on having a bunch of nested arrays. The idea is that I
pass an X and a Y coord as arguments and then it returns the Xth element
in the Yth array.
The problem is that I cant seem to get a specific value from a nested
array.
For example, this works:
irb> array[2]
=> [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
But this doesn't seem to:
irb> array[2[2]]
=> [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
I'm pretty sure I'm just getting the syntax wrong.
basically works on having a bunch of nested arrays. The idea is that I
pass an X and a Y coord as arguments and then it returns the Xth element
in the Yth array.
The problem is that I cant seem to get a specific value from a nested
array.
For example, this works:
irb> array[2]
=> [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
But this doesn't seem to:
irb> array[2[2]]
=> [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
I'm pretty sure I'm just getting the syntax wrong.