Masthead

Calling Functions

When you call a function, the main script passes the "parameters" "into" the function. This creates new variables within the function. Your function can access these variables and can create it's own variables as well. When your function returns, it can send back a single variable in the "return()" statement. Then, all the variables that are "local" to the function will be deleted.

Interactive widget that dmonsracts how the program counter goes into a function passing paramematers that are assigned to variables in the function.  Then, when the function exits how these variables disappear and only the return value remains.

 

© Copyright 2018 HSU - All rights reserved.