In the last chapter, you saw that you could create programs that used the methods you had created in different ways. Same set of methods, but used in ways to give different outcomes. You both ordered them differently, and called the same method more than once.
These are both important reasons for using methods. In this chapter, we are going to learn about another way of using methods that makes our job as programmers easier - but let's not give the game away...
Things you will learn in this module:
Vocabulary for this module:
Parameter: specified in a method, this is the name given to a value that is supplied when the method is called. The name can be used in the method code to refer to, or access, the value supplied.
Method Call: similar to the method calls we've seen before, only now we need to supply values if the method has specified that it uses parameters.
"pass values to" a method that "takes" parameters: so far on this page, we have said that "values are supplied when the method is called", if the method specifies that it uses parameters. The computer speak for this is as follows. A method that specifies that it uses parameters is a "method that takes parameters", and when calling such a method, we say that we "pass values to the method".