January 2001
Beginner
312 pages
6h 4m
English
In their simplest form, functions are a group of statements that do something and that are placed under one name. A function takes the following form:
function functionname()
{
statements go here!;
}
A function consists of the word function followed by the name you give the function, such as yourMessage. Then, parentheses are placed after the function name—for example, yourMessage(). These are required, and an error is generated if they are omitted.
NOTE
For the moment, these parentheses will remain empty. Later in this chapter, you'll see what they are used for.
After the parentheses are the opening and closing curly braces, in between which are the statements.
Each function you use must be given a name, and no two functions ...
Read now
Unlock full access