Starting with the Syntax of Structured Text

<< Click to Display Table of Contents >>

Navigation:  Project > Scripts > ST language >

Starting with the Syntax of Structured Text

Previous pageReturn to chapter overviewNext page

The syntax of a programming language is the definition of how it is written. To be more precise, what symbols is used to give the language its form and meaning.As you can see in the example, Structured Text is full of colons, semicolons and other symbols. All these symbols has a meaning and is used to represent something. Some of them are operators, some are functions, statements or variables.All the details of the syntax will be explained as you move through this tutorial. But there are some general rules for the syntax of Structured Text you should know about. You don’t have to memorize all the syntax rules for now, as you will when you get your hands into the programming:

All statements are divided by semicolons

Structured Text consists of statements and semicolons to separate them.

The language is case-sensitive

It is good practice to use upper- and lowercase for readability.

Spaces have no function

But they should be used for readability.

What’s really important to understand here is that, when you write a TeslaSCADA2 program in IDE in Structured Text, your computer will translate that to a language the TeslaSCADA2 Runtime can understand. Before you use project that contains the Structured Text TeslaSCADA2 program to your TeslaSCADA2 Runtime, the IDE will compile your program. This means that it will translate the code to a sort of machine code which can be executed by the TeslaSCADA2 Runtime. The compiler uses the syntax of the programming language to understand your program. For example: Each time the compiler sees a semicolon, it will know that the end of the current statement is reached. The compiler will read everything until it reaches a semicolon, and then execute that statement.

 

Comment Syntax


In textual programming languages you have the ability to write text that doesn’t get executed. This feature is used to make comments in your code.Comments are good, and as a beginner you should always comment your code. It makes it easier to understand your code later. In Structured Text you can make either one line comments or multiple line comments.

Single line comment:

//comment

Multiple line comment:

/* start comment

...

end comment */