3 ms·
Besides brevity is there any other case for implicit return values? I love little lambdas as much as the next guy but does the cost have to be that every one o
by pak 16y ago
Besides brevity is there any other case for implicit return values? I love little lambdas as much as the next guy but does the cost have to be that every one of my functions returns something unless I write an extra line to the contrary?
I'd rather pay the price of typing
return self.shipping = false
to make the function return false if I actually wanted it to do so, rather than
self.shipping = false
true
which just looks bizarre to me and doesn't make its motive clear (you wind up only including it when your last expression evaluates to false). I have vague, unpleasant memories of also encountering this gotcha with Perl in RT scrips, where you would suffix silly little 1;'s and 0;'s to everything to make the next action run or not run.
I don't know about everybody else, but I don't FP to the extent that I never write subprocedures. Isn't this still typical?