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
Post a Comment