Skip to Content
Learn
Functions
How Parameters & Arguments Work

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.

Folder Icon

Take this course for free

Already have an account?