# deffun statement

Use the deffun statement to define a user-written external function
 (for example, an external sub-routine invoked using CALL).

The deffun statement provides the compiler with information such as the
 function name, the function number, and the type of arguments. In a program, each user-written
 function must have a unique definition.

## Syntax

```
 deffun function {(argument{,argument...})}
```

## Parameter(s)

| function | The name of the user-written function. |
| --- | --- |
| argument | The list of arguments passed to the external function. |

## Example(s)

**Example 1**

 This block declares the function MYFUNC in the calling program. It uses the function with the
 statement `PRINT MYFUNC(A,B,C)`:

```

 deffun myfunc(a,b,c)
 print myfunc(a,b,c)
```

 **Example 2**

 This block defines the previously referenced user-written external function, called MYFUNC,
 with the arguments A, B, and C:

```

 function myfunc(a,b,c)
 return a*b*c
```

## See also

- [function statement](https://d3codex.com/pickbasic-flashbasic/function-statement/)
- [return statement](https://d3codex.com/pickbasic-flashbasic/return-statement/)
- [statement labels](https://d3codex.com/pickbasic-flashbasic/statement-labels/)

---
Source: https://d3codex.com/pickbasic-flashbasic/deffun-statement/ - part of the D3Codex reference.
