What you'll build
- A function that makes a different sentence based on the values you pass in to it.
What you'll learn
- How to make more powerful functions by passing in values.
- How to make functions that return values.
- How to name functions and arguments to make your programs readable.
Key vocabulary
Introduction
The functions you’ve used so far can be thought of as opaque boxes with a big “Go” button on the outside. You hit the button and the function does its work. The work is the same every time. If you want the function to do different work, you have to write a different function.
In this lesson, you’ll learn that functions can be much more powerful. By passing values in to functions, you can make them more flexible so they can be used in a variety of situations. And by calling functions that return values, you can use the results of one function as the input to another. You’ll also learn about ways to make your programs easier to understand and easier to read, even after you’ve added more complexity.
Go Build
Open the Parameters and Results.playground file in your course resources and follow the instructions.

Reflection Questions
You can now build functions that take information in and use it in the work they perform. But the work is still the same.
What if you could do different work that depends on the information that’s passed in?
Can you think of some real-life processes and tasks that fit into the various ways you can define a function (with or without parameters, with or without a return type)?
Summary
You can now think of a function as more than a simple opaque box with a single button. A function is more like a machine in a factory, with arguments going in at one end, work happening inside, and a return value coming out the other end.
With this kind of complexity, functions are capable of doing some powerful work.
When it comes to writing programs that are easy to read and understand, you’ve learned that naming your functions and their arguments is very important. You've also learned that function calls are another type of expression—they can be used anywhere your code expects a value.
If you've been keeping track, you can list all the kinds of expressions you've learned about:
- literals
- constants and variables
- mathematical expressions
- function calls
In the next lesson, you’ll learn how your code can make decisions as your program runs. You can use this decision-making ability to write functions that do different work depending on the parameters passed in.