Multiple type declarations with if-else

There’s a distinction between the assignment and the declaration of the name x. Yes, you’ll only ever assign to x once, but that one x name is the same throughout the entire function (including before the assignment, amusingly enough). While the program flow will only ever see one of the two branches, the syntax applies to the entire function.

3 Likes