2 ms·
The hidden side-effects of your example code make it hard to reformat, but in general people don't advocate for your first example. The push is more towards def
by kilburn 5y ago
The hidden side-effects of your example code make it hard to reformat, but in general people don't advocate for your first example. The push is more towards defining smaller logic blocks (with names that hint at what they do):
def computeSomething() {
if (condition1) return 0;
let value = getValueSomehow();
if (condition2) return value;
doSomethingElse();
return value + getSomeOtherValue();
}
let value = computeSomething();
finishUpBusinessLogic();
return value;