3 ms·
One pattern that comes to mind: while (true) { if (testState()) return valueOfState(); } moreStateChangingStuff() as opposed to: var flag = false
by lhorie 17y ago
One pattern that comes to mind:
while (true) {
if (testState()) return valueOfState();
}
moreStateChangingStuff()
as opposed to:
var flag = false, result = null;
loop(function() {
if (testState()) {
flag = true
result = valueOfState()
}
})
if (flag) return result
moreStateChangingStuff()