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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -