Learn

A function with parameters has a couple of requirements:

  • The function call must include the same number of arguments as there are parameters.
  • The corresponding arguments must be passed in the same order.

By calling a function with arguments, you are telling a function, “Hey function, when you execute, use these values where you have parameters in your definition.”

While it executes, anywhere the function comes across a parameter, it replaces the parameter with the corresponding argument you gave it.

Instructions

Take a look at how our updated make_sandwich() function executes when it gets called with ingredients as arguments.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?