Warning 19.4.1.
A
return
ends a function immediately.return
, it does just that: it returns to the place the function was called. The program below tries to use the addFive
function to add 5 to the score; however, the code in the function that does the math comes after the return and thus never runs! Try running it in Codelens mode to see:return
ends a function immediately.score
is passed as the argument from the main part of the program into addFive
. That means addFive
uses a copy of score
’s value as its value for x
. But x
and score
are not linked in any way. A change to x
does nothing to change the value of score
. Nothing is ever returned, so the rest of the program never learns about the changes that happened in addFive
.