Section 1 - Instruction

Last time, we learned how to create and call functions. But our functions were pretty basic - they always did exactly the same thing every time we called them.

Engagement Message

What if we could make functions more flexible and useful?

Section 2 - Instruction

We can! Functions can receive information from us when we call them. This information is called parameters (when defining the function) or arguments (when calling the function).

Engagement Message

Think of it like giving instructions to that helpful assistant - what information would they need?

Section 3 - Instruction

Parameters go inside the parentheses when we define a function. Here's how we add a parameter called name to our greeting function:

Engagement Message

Notice the variable name inside the parentheses?

Section 4 - Instruction

Now when we call this function, we pass an argument inside the parentheses. The argument becomes the value of the parameter inside the function:

Engagement Message

See how the same function produces different outputs?

Section 5 - Instruction

Functions can have multiple parameters too! We separate them with commas. Here's a function that takes a name and an age:

Engagement Message

How many arguments do you think we need when calling this function?

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal