Navigation:  ThinBASIC language > Script structure > Functions/Subs >

Function_Name

Previous pageReturn to chapter overviewNext page

 

Description

 

If used inside a function, returns the name of the current function.

 

Syntax

 

sName = Function_Name

 

Returns

 

String.

 

Parameters

 

Name

Type

Optional

Meaning





 

Remarks

 

Restrictions

 

Command must be used inside a function.

 

See also

 

Examples

 

'---Sum till 10 numbers using optional parameters

'---At least one number must be passed but even first parameter

'---can be declared as optional

FUNCTION MySum(  _

               N01 AS EXT  , _

      OPTIONAL               _ '---From here all parameters will be considered optional

               N02 AS EXT  , _

               N03 AS EXT  , _

               N04 AS EXT  , _

               N05 AS EXT  , _

               N06 AS EXT  , _

               N07 AS EXT  , _

               N08 AS EXT  , _

               N09 AS EXT  , _

               N10 AS EXT    _

           ) AS EXT

 

  FUNCTION = N01 + N02 + N03 + N04 + N05 + N06 + N07 + N08 + N09 + N10

  MSGBOX 0, _

              "You are inside function " & FUNCTION_Name & $CRLF & _

              "Function has been declared to have " & FUNCTION_NParams & " parameters." & $CRLF & _

            "This function has been called with " & FUNCTION_CParams & " parameters."

 

END FUNCTION

 

MSGBOX 0, "Sum: " & MySum(1,2)