DEV Community

Discussion on: Another GOTO to avoid

Collapse
 
qm3ster profile image
Mihail Malo

Thank you for reading and your feedback. I am aware it's a very contrived one, but I wanted it to be extremely short as I wanted to copy paste it many times over to show every step.

  1. That would be value * 2 + 1, not value + 2
# Code blocks break numeration on DEV.to
  1. That's a very different language, and without going into how recursion is memory-performant there and other niceties like pattern matching, the fact it's the only way justifies it already. Coming back to this case, I'd like to note that there's no iteration in the task at hand, yet when we first got rid of the switch case, we got a little runtime recursion.