And a step further into the past, no need for a lambda - I find this clearer:
function doWork() {
function calcX() {
if (foo()) return f();
if (bar()) return g();
return h();
}
return calcX() * 10;
}
Where "calc" can be "gen[erate]" or "find" or at least more descriptive.