re: Another GOTO to avoid VIEW POST


While I am in 99% agreement, there are two things I want to point out:

  1. Decouple as much as possible. I understand the example is contrived, but you probably should either invent more vivid example that has indeed logically coupled functions, or stick with
const operations = {
  bigIncrease: (value => value + 2),
  bigIncreaseAlias: (value => value + 2),
  smallIncrease: (value => value + 1)
  1. There are some languages like Erlang where recursion is the only supported way of iteration. No other kinds of loops, yay.

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
  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.
code of conduct - report abuse