in reply to if else and not reachable coding style
Two alternatives that noone else has mentioned yet:
# both branches are very long sub wibble { return 1; } sub wobble { return 2; } sub sg { return COND ? wibble( @_ ) : wobble( @_ ); }
# one branch (symbolised here by `return 2`) is much shorter than the +other sub wibble { return 1; } sub sg { return wibble( @_ ) if COND; return 2; }
If you avoid monolithic conditional code blocks, most of the time your question will trivially resolve itself.
Makeshifts last the longest.
|
|---|