Functions - Calling A Function
Calling a Function
Calling, or invoking, a function means that we jump from wherever the function is called to the code inside the function. You can do this by typing the function name and then parentheses. Let's try calling MyFunction:
When this code is run, you should see an ERROR! This is because when we defined MyFunction, we specifically required the parameter: String parameter. So, we need to provide this parameter when we call it. Try editing the above code so that it works! (Hint: Look at where we defined the parameter, and then compare that to when we call MyFunction().) If you're having trouble, scroll down to see the solution.
Hopefully you figured it out! Here's the corrected code:
Great, we can define and call functions! But, what if we want to get some data from a function?
ByteBrawl
0