Saturday, December 11, 2010

What is a Function?

Up until this point, every line of code we've shown you has done a simple task, such as performing an arithmetic operation, or checking a boolean condition, or assigning to a variable. Functions allow you to do a whole lot in one line of code. Instead of performing a simple task, a single line of code can display a menu of choices, or compute complicated three-dimensional transformations, or even play Tetris!
How is this possible? Functions allow you to group a series of steps under one name.

No comments:

Post a Comment