R – Does Ruby best practice shun statement modifiers after, for example, a long code block that is passed to an iterator

rubystatement-modifiers

something.each do |x|

  #lots of stuff

end if some_condition

Best Answer

I think the popular way is to use statement modifiers only if it is a one-liner. In all other cases, use the normal if style prevalent in C, Java etc.

bail_out if reqd_param.nil?

if its_gonna_be_long then
  long_exec stmt1
  long_exec stmt2
  ....
end
Related Topic