3 ms·
And even if using an if, you can make it smaller with foo = 1 if foo.nil?
by crooked-v 9y ago
And even if using an if, you can make it smaller with
foo = 1 if foo.nil?
- maze-le 9y agoInline conditionals can be a blessing and a curse. In this case, it is absoluteley alright to use them (I find it also more elegant). But I have also seen things like: my_fancy_named_variable = my_array.map{|x| do_processing(x)}.sort_by{|x| x.value} unless some_very_long_conditional_that_breaks_readability This is not very readable, and I would actually use multiple lines to format a call like this.