Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


2.3 Parameters

Generally we want procedures to work with particular data. In our example we wanted the WriteF procedure to work on a particular message. We passed the message as a parameter (or argument) to WriteF by putting it between the parentheses (the `(' and `)' characters) that follow the procedure name. When we called the fred procedure, however, we did not require it to use any data so the parentheses were left empty.

When defining a procedure we define how much and what type of data we want it to work on, and when calling a procedure we give the specific data it should use. Notice that the procedure fred (like the procedure main) has empty parentheses in its definition. This means that the procedure cannot be given any data as parameters when it is called. Before we can define our own procedure that takes parameters we must learn about variables. We'll do this in the next chapter. See 3.1.4 Global and local variables (and procedure parameters).


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.