3 ms·
In most cases this will boil down to: n := defaultVal if expr { n := otherVal } Which I think is easier to understand, and not that much mor
by lmb 10y ago
In most cases this will boil down to:
n := defaultVal
if expr {
n := otherVal
}
Which I think is easier to understand, and not that much more typing. YMMV of course.
- gkya 10y agoIf defaultVal is a constant, this is OK, but what if it requires computation?