Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Functions, Packing, and Unpacking!
You have completed Functions, Packing, and Unpacking!
Preview
How to get data out of functions using returns.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Since the code in a global context
can't access what's in a local context,
0:00
functions might seem pretty limiting.
0:02
What's the point if what happens
inside them stays inside them?
0:05
Well, programmers have a solution for
this, it's called returning.
0:09
Returning a value from a function
is extremely common, and
0:13
it's a tool you'll use all the time, and
you only need to know one word, return.
0:17
Let's look at an example, feel free to
just watch and follow along with my
0:22
workspace, you'll have an opportunity
to try on your own shortly.
0:25
So here we have a function
called two_plus_two.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up