Overview: 2.4.0

  • Methods can take arguments or parameters to use variables within
  • actual parameters or arguments are put inside of the parenthesis of some methods
    • the turn method of Turtle intakes an angle to turn a specific number of degrees
      • turguggins.turn(100) to turn 100 degrees

Parameters vs Arguments

  • Variables defined as inputs to methods are formal parameters
    • If I were to define a new function makePizza(Cheese cheese, Sauce sauce, PizzaDough dough), cheese, sauce and dough would be formal parameters
  • When a method is called, you pass arguments or actual parameters which are saved in the parameter variables
    • If I called my method with makePizza(cheddar, marinara, wholeGrain), cheddar, marinara, and wholeGrain would be arguments

Overloading

  • a method is overloaded when multiple methods with the same name, but with different parameters

Summary: 2.4.3

  • methods are behaviors/functions objects cna do
    • called with the dot operator
      • turguggins.forward(30)
  • Some methods take parameters which are placed in the parenthesis
  • Arguments must correspond with the type and order as defined in the parameter list created with the method signature