MarkWilliams (1) [Avatar] Offline
Hi, on page 64, I believe this statement is not quite correct:

3. Let’s look at the function body. We can see that the first branch of the if / then code
now returns a string rather than an int. So, the compiler has used this to infer that
the function should take in a string.

The first branch has always returned a string, that's not what changed. What changed is that number is now being compared to the string "hello" rather than the int 10. Therefore, the compiler infers that number must be a string.
Isaac Abraham (68) [Avatar] Offline
Great spot. I think that this slipped through because an earlier version of the code worked that way rather than with a comparison. We'll get this fixed for the final release - thanks!