FNC

FNC F

DEFINES THE FUNCTION F

  • Type: Command
  • Parameters: n
  • Group: Structures

ACTION

The command FNC F begins the function called F.

A function is a group of statements which can be called in an expression and which returns a value by the command RESULT.

The functions are typed like the variables:

- if the name of a function ends by %, it returns an integer

- if the name of a function ends by $, it returns a string

- if the name of a function ends by a letter or a number, it returns a real

SYNTAX: FNC F(P1, P2 ,…)

  • F : string, subroutine name
  • P1, P2 : optional parameters

USE

  • The command FNC is used to define a function.

ERROR

  • If the function name is not correct.
  • If the function name is already defined.
  • If the name of a parameter is not correct.

EXAMPLE

dim i%

for i%=1 to 10

print double(i%)

next i%

end

fnc double(j%)

result 2*j%

end_fnc

SEE ALSO

RESULT

END_FNC

EXIT_FNC