For this feature I prefer to think and talk in terms of definite assignment, because I think that tracks the multi-branch rule at its heart.
For assignment I think =
, :
and :=
as operators.
So perhaps another option for disambiguation might be the colon, by extension from the case statement implicit assignment:
let x = if big() { 10 } else if small() {100} else {
let median = median()
let weight = weight(count)
: minimum + median * weight
}
If so, :
or :=
should also be permitted in a single-statement block for clarity and visual redundancy. I do think it's helpful to point backwards somehow to indicate the hoisting of the value outside its scope, because people don't always read complex expressions left to right in order.
let x = if big() { : 10 } else if small() { : 100 } else ...
(otw, I personally preferred the implicit return of the last statement until it was suggested to be too unwieldy for Swift. I also considered just using the outer variable to assign (and naming return values, as Go does), but perhaps that's a bridge too far.)