# endfunction

## Syntax

    endfunction variable

## Description

These commands will declare a user defined function within your program. User functions work in the same way normal commands work. They can accept multiple parameters and return values in the same manner, allowing you to create customized commands within your program. It is vital that if exit function command is used within a function declaration, that the return types are identical not only in data type, but whether they are arrays, variables or literals. You also cannot have expressions as part of the return data.

## Example

    rem example 1
    do
        myFunction ( )
    loop

    function myFunction ( )
        print ( "inside myFunction" )
    endfunction

    rem example 2
    do
        a = myFunction ( )
        print ( a )
    loop

    function myFunction ( )
        returnValue = 123
    endfunction returnValue