<!-- PDF page 30 -->

and **ENDPROC** which takes one of two forms:

**ENDPROC**

or –optionally–

**ENDPROC** =*result1*[,...,*resultN*]

Anything that follows the keyword **DEFPROC** is the procedure itself, however there can be multiple exit points for each procedure designated by separate **ENDPROC** statements.

Parameters in *brackets*, denote that the syntax is optional and *def1* to *defN* (also in *brackets*) are optional default values for each parameter. Procedures are called with the keyword **PROC** (and **BANK PROC** in the case of a banked procedure). This, like **ENDPROC** takes two forms:

[**BANK** *n*] **PROC** *name* **(**[*parameter1*[,...[,*parameterN*]]]**)**

which calls the procedure named **name** with optional parameters 1 through N –or–

[**BANK** *n*] **PROC** *name* **(**[*parameter1*[,...[,*parameterN*]]]**)** **TO** *variable1*[,...,*variableN*]\
*which is the same as above but assigns the values returned by the procedure to the optional variables 1 through N.*

Note that if there's a default value for a parameter, we can omit it when calling the procedure with **PROC**.

> **Notes**
>
> If you're using the *NextBASIC*'s memory bank management facilities to extend the size of your programs, the following apply:
>
> 1. Any **GO TO**, **PROC** or **GO SUB** within a banked section will go to a line or label in the same bank.
> 2. Any **RETURN** will always return to the calling bank.

Consider the example below:

```
 10 CLS
 20 PROC Pdemo(11): PROC
    HelloWorld("Hello
    World!",1)
 30 PROC HelloWorld("Hello
    Stop!",):; 2nd parameter
    omitted
 40 GO TO 160
 50 DEFPROC Pdemo(x)
 60   PRINT x; " raised to the
    2nd power is:"; x*x
 70 ENDPROC
 80 DEFPROC HelloWorld(z$,
    n=0)
 90   LOCAL a$,l
```

