For instance, this takes 4 lines which is too much space for such a simple operation:
if something_is_true
puts 'error'
return
end
this one is a one-liner but looks awkward.
if something_is_true; puts 'error'; return; end
Can we do something like
# it would be great if this would work because it is short and readable
puts 'error' and return if something_is_true
I'm not sure why you think space is at such a premium that your original code is "too much." Give your code room to breathe, and let it take the space it needs. Getting too tricky in order to "save space" is a false economy. The most important thing is that your code be readable and understandable. Your original code looks great to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With