5 Functions
In Chapter 3, you learned that a variable is a name associated with a chunk of data. A function is a name associated with a chunk of code. You can pass information to a function. You can make the function execute code. You can make a function return information to you.
Functions are fundamental to programming, so there is a lot in this chapter – three new projects, a new tool, and many new ideas. Let’s get started with an exercise that will demonstrate what functions are good for.
When should I use a function?
Suppose you are writing a program to congratulate students for completing a Big Nerd Ranch course. Before worrying about retrieving the student list from a database or about printing certificates on spiffy ...
Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.