| .Selected Example Procedures. |
|
  Selected Programs    Example Procedures    Contents    Index |
| ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ |
| Procedures |
|   |
| The following programming examples illustrate how to code and combine |
| small logical components of programs. There are examples for boths SUBs |
| and functions. |
|   |
| Programming example 1 - using functions |
|   |
| Corresponding variables must have the same type in both the argument and |
| parameter lists for a function, as shown in the following example. |
| In this example, two arguments are passed to the FUNCTION procedure. |
| The first is an integer specifying the length of the string returned |
| by the FUNCTION, while the second is a character that is repeated |
| to make the string. |
|   |
|   FUNCTION CharString$(A AS INTEGER, B$) STATIC |
|     CharString$ = STRING$(A%, B$) |
|   END FUNCTION |
|   |
|   DIM X AS INTEGER |
|   INPUT "Enter a number (1 to 80): ", X |
|   INPUT "Enter a character: ", Y$ |
|   |
| ' Print a string consisting of the Y$ character, repeated |
| ' X number of times: |
|   PRINT CharString$(X, Y$) |
|   END |
|   |
| Sample output |
|   |
| Enter a number (1 to 80): 21 |
| Enter a character: # |
| ##################### |
|   |