Skip to main content
typo
Source Link
Phillip B Oldham
  • 19.5k
  • 20
  • 98
  • 136

Structured programming says you should only ever have one return statement per function. This is to limit the complexity. Many people such as Martin Fowler agrueargue that it is simpler to write functions with multiple return statements. He presents this argument in the classic refactoring book he wrote. This works well if you follow his other advice and write small functions. I agree with this point of view and only strict structured programming purists adhere to single return statements per function.

Structured programming says you should only ever have one return statement per function. This is to limit the complexity. Many people such as Martin Fowler agrue that it is simpler to write functions with multiple return statements. He presents this argument in the classic refactoring book he wrote. This works well if you follow his other advice and write small functions. I agree with this point of view and only strict structured programming purists adhere to single return statements per function.

Structured programming says you should only ever have one return statement per function. This is to limit the complexity. Many people such as Martin Fowler argue that it is simpler to write functions with multiple return statements. He presents this argument in the classic refactoring book he wrote. This works well if you follow his other advice and write small functions. I agree with this point of view and only strict structured programming purists adhere to single return statements per function.

Post Made Community Wiki by CommunityBot
Source Link
Chris de Vries
  • 57.8k
  • 6
  • 34
  • 27

Structured programming says you should only ever have one return statement per function. This is to limit the complexity. Many people such as Martin Fowler agrue that it is simpler to write functions with multiple return statements. He presents this argument in the classic refactoring book he wrote. This works well if you follow his other advice and write small functions. I agree with this point of view and only strict structured programming purists adhere to single return statements per function.