Creating an Array: Difference between revisions
Content added Content deleted
Line 75: | Line 75: | ||
#You would call the array by this code. This will call the 3rd 1 on the second list |
#You would call the array by this code. This will call the 3rd 1 on the second list |
||
echo $array[1][3]; |
echo $array[1][3]; |
||
==[[Ruby]]== |
|||
array = [ |
|||
[0, 0, 0, 0, 0, 0], |
|||
[1, 1, 1, 1, 1, 1], |
|||
[2, 2, 2, 2, 2, 2], |
|||
[3, 3, 3, 3, 3, 3] |
|||
] |
|||
#You would call the array by this code. This will call the 3rd 1 on the second list |
|||
array[1][3] |
|||
# You can also create a sequential array from a range using the 'splat' operator: |
|||
array = [*0..5] |
|||
#=> [0,1,2,3,4,5] |
|||
==[[Ada]]== |
==[[Ada]]== |