3 ms·
Scope the assigned variable to the if statement.
by wffurr 7y ago
Scope the assigned variable to the if statement.
- mc3 7y agoIf so, it might be a code smell to consider defining a separate function.
- rs23296008n1 7y agoSo far, all the suggested usages of := have a code smell about them.
- archgoon 7y agothat's not how the walrus operator works though. if x := 3: print("x is now: ", x) print("x isn't scoped to the if:",x)