4 ms·
> The first form requires extra work to escape spaces The first form is generally used for symbol-type strings (word lists, essentially, hence "w"). It is less
by masklinn 14y ago
> The first form requires extra work to escape spaces
The first form is generally used for symbol-type strings (word lists, essentially, hence "w"). It is less syntactically noisy, shorter and requires less waffling around with non-word keys.
That's especially flagrant if you don't ignore half the actual array,
%w(foo bar baz)
really results in
["foo", "bar", "baz"]
(the quotes are rather important, because they're noisy, repetitive and annoying to type).
It's one of the few things I regularly wish were in more languages.
- Karunamon 14y agoAhh.. I forgot about the quotes. That's what I get for posting immediately after waking up. Thanks :)