User-defined functions

<< Click to Display Table of Contents >>

Navigation:  Project > Scripts > ST language >

User-defined functions

Previous pageReturn to chapter overviewNext page

Also you can use user-defined functions in Structured Text language for TeslaSCADA2. You can find example below:


function fun(a,b){

int c;

if (a>b){






return c;


int d = fun(13,17);



 In this example user function starts with key word function. Then name of the function. Then in parentheses arguments are listed. Inside braces {} statements of the function. User-defined function must be announced before main program. In this example program text of function fun is in the beginning. And only after statements of fun function, text of the main program. Results of this script will be 4 in the log window.