Section 1 - Instruction

We've covered a lot about functions—creating them, using parameters, and returning values. Now let's put it all together by building a useful function from scratch!

Engagement Message

Ready to become a function-building expert?

Section 2 - Instruction

Let's design a function step-by-step. We want to calculate the final grade for a student, given a list of scores.

Engagement Message

What information do we need to provide to this function as parameters?

Section 3 - Instruction

Here's our plan: our function will accept an array of scores. It will then calculate the average score and return a letter grade based on that average.

Engagement Message

Can you see the logical flow?

Section 4 - Instruction

Let's implement it! We can use a for loop to sum the scores, then divide to get the average. The if/else if chain then determines the grade.

Engagement Message

What could be the next line in our function above?

Section 5 - Instruction

Common function mistakes include forgetting return statements, mixing up parameter order, or using unclear names. Always test your functions with different inputs to catch these issues early.

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