syntax - What's the difference between [[]] and [] in Ruby? -
came across snippet :
@@datalist[i] = [[0,[]]]
what double brackets do? if wrote :
@@datalist[i] = [0,[]]
.. work different?
[]
empty array.
[[]]
array containing empty array single element.
[0,[]]
array containing 2 elements.
[[0, []]]
array containing 1 element, happens array.
Comments
Post a Comment