Personally, I'm almost painfully verbose with my parens to avoid exactly this scenario. Better to be explicit about my intent to the interpreter and other coders.
Having an assignment that could be skipped by short-circuiting also seems like bad practice, but I realize it was designed to be a toy example
Comments
Personally, I'm almost painfully verbose with my parens to avoid exactly this scenario. Better to be explicit about my intent to the interpreter and other coders.
Having an assignment that could be skipped by short-circuiting also seems like bad practice, but I realize it was designed to be a toy example
Skipping the second assignment if I don't need it is more of an optimisation. The "long form" would be,
first_user = User.find(4) if first_user second_user = User.find(6) if second_user ... end end