ruby - Is it possible to create a nil value in an array using %w[] shorthand? -


say want create array ["one", "two", nil], possible using shorthand %w[] syntax? not work:

array = %w[one 2 nil] => ["one", "two", "nil"] array[2].nil? => false 

ruby 1.9.3

no. whole purpose of convenience syntax avoid putting quotes around string literals, , separator comma.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -