Hacker News new | ask | show | jobs
by throwaway2016a 3161 days ago
I think the readability to an inexperienced coder greatly improves just by moving the "robot.number++" outside the conditional and perhaps even changing it to "robot.number = robot.number + 1"

Though that is slightly different (since ++ will execute after the conditional is evaluated when following the lval but the change will make it run before)

Edit: on 2 seconds though... put that code AFTER the if statement and it would behave exactly as the example.