Incidentally, I'm not personally very fond of "assigning an if-expression to a variable" since it disconnects the variable name from the value it gets. An example with two variables illustrates the point:
let (value, weight) = let (value, weight)
if values.empty() { if values.empty() {
(0, 1.0) value = 0
} else { weight = 1.0
(values[0], 1/values.len()) } else {
} value = values[0]
weight = 1/values.len()
}
I think the right (the "old way") is more readable. However it requires the variables be mutable or declaration be separable from initialization.