/
Where in the script are functions defined?

Where in the script are functions defined?

Q

Where in the script are functions defined?

A

A function can be defined at any place in the script.Defining a function does not call the function, it just creates the resource for it.

The definition must have been executed once before the function can be called, else you get a runtime error.

Example Code:

function newMainStateMachine()
    local sm=newStateMachine()
    local STATE_Init=0
    local STATE_InitStacks=1
    local STATE_Subscribe=2
    local STATE_Run=3
    local STATE_Error=100
    local STATE_NotSupported=200
    sm.INPUT_None=0
    sm.INPUT_Error=1
end


Related content

What shall be programmed in the scripts "initialization" phase?
What shall be programmed in the scripts "initialization" phase?
More like this
Where are "constants" defined?
Where are "constants" defined?
More like this
How is a "local" variable distinguished from a "global" variable?
How is a "local" variable distinguished from a "global" variable?
More like this
How can you avoid that the whole script code is executed?
How can you avoid that the whole script code is executed?
More like this
How can a variable be created?
How can a variable be created?
More like this
In the configuration tool SYCON.net exists the possibility to define variables outside the script, how can I access to those variables in my script?
In the configuration tool SYCON.net exists the possibility to define variables outside the script, how can I access to those variables in my script?
More like this