3 ms·
Right - that single-exit-point rule is generally a holdover from C. It is pointless in languages like C# or Java which have GC and 'try' or 'using' blocks. In
by SideburnsOfDoom 11y ago
Right - that single-exit-point rule is generally a holdover from C.
It is pointless in languages like C# or Java which have GC and 'try' or 'using' blocks. In some cases the single return is nicer, but this is not universal nor is single return "required" in all cases.
In functional languages such as F#, Haskell or Erlang where the method is usually side-effect free and uses pattern-matching, multiple return-points are completely normal and no-one even sees an issue.