3 ms·
I use pretty much the same style for my Ruby work. One thing I do differently is replacing %w(word1 word2 word3) with %w[word1 word2 word3] both result
by jhund 14y ago
I use pretty much the same style for my Ruby work. One thing I do differently is replacing
%w(word1 word2 word3)
with
%w[word1 word2 word3]
both result in
["word1", "word2", "word3"]
I prefer the bracket delimiters since they better indicate the array nature than the parens. In % notation you can choose your own delimiters, so why not use brackets?
- yxhuvud 14y agoBoth are fine. Just don't use linebreaks or weird utf8 characters, please. EDIT: As delimeters. Feel free to use them inside the strings.