Stweep S tweep A Guide To Structured Text Structured Text is a commonly used term to describe any kind of text that has been prepared using structured grammar and code, where the meaning of each line of text can be deduced easily. It was first introduced in the IT Industry during the mid '60s. The main reason behind its popularity is its ability to provide a better means of communication than traditional, handwritten notes. However, it has some dr awbacks. For example, it is very time consuming and laborious to write and edit structured texts. It also does not hold true for all types of texts. Structured Text is mainly used for programmatic automation of various business applications, where a series of repetitive commands are written to form a series of structured texts. Typically, the content of a text is a series of blocks, each block having a definite nesting level. In a simple example, the series of blocks may be as follows: Product Name, Product Description, Key Features and Benefits, Free Trial, Free Samples, and so on. Nested loops are a series of such blocks that nest within other blocks. Such nesting levels can be easily identified using a text processing tool. Visit CoDeSys An application writing tool that uses Structured Text Format is called a Compiler. A Compiler is used to convert a series of unformatted text expressions into a series of structured text statements, with every statement having a defined nesting level. As a result, the number of statements written using Structured Text is considerably lesser than the number of statements needed to generate a similar program using only plain text. Moreover, the generated program is much more compact and error free. The main advantage of this type of application is that Compilers are able to detect and eliminate various errors such as wrong numbers of arguments, missing keywords, ambiguous sentences and missing commas. It is possible to generate str uctured text by hand using a programming language like SQL, C/C++ or PHP. However, such programs can be time - consuming and inconvenient because they generate a large amount of output. Also, manual Structured Text programs are prone to mistakes because prog rammers often make mistakes during the formatting or indentation of a statement. Such mistakes are very common in commercial software applications that use Structured Text as a primary programming language. Click here TwinCAT Structured Text is written using a text processing program or editor. Common programs include Text editors like WordPad or Courier; web browsers like Netscape or Mozilla Firefox. One can also write Structured Text directly in a text editor. A var iation on Direct Text is known as "Direct X" and can be transmitted over the Internet using applications such as WinINET, ICQ, AOL Classic, Windows ME or Java. The major advantage of Structured Text over Direct Text is that multiple conditions can be speci fied for an expression without requiring the developer to write multiple code lines. A popular variation on Structured Text is a form called "ops". An op is a piece of code that is only executed one time when the result of an expression is true. A typical example of an op in Structured Text would be the end_for(i) which is defined as: When i is greater than 10 This condition is checked every time the i variable is changed. The benefit of using an Op instead of a Condition is that it can be used when there is a need to evaluate whether or not the result of an expression is true or false instead of having to evaluate each and every time it is used. Another minor difference between Structured Text and other forms of semicolons is that in Structured Text, sem icolons may be omitted if the programmer so chooses. In most other cases, however, a semicolon is required, even though some will see this as a small detail. Some find it unnecessary to even define a semicolon in Structured Text, because any number of cons ecutive code lines can be written without semicolons. For example, the following code fragment would be acceptable in Structured Text: Every time a user clicks the mouse, a number of lines of code are written to the computer. If the user stops pressing the mouse, the program is restarted and a new line is written. In this case, the semicolon is not required. One more difference between Structured Text and many other forms of code is the fact that in a Structured Text assignment statement looks like a norma l assignment statement. In most other cases, however, the programmer must define a separate assignment statement to be placed at the beginning of the file, or in a dedicated procedure file. Even then, this usually does not take the place of a semicolon, as the compiler's optimizer will complain if the assignment statement is part of a string instead of a scalar. Visit Structured Text Summary Every programmer knows the importance of well formatted code. STweep is a source code formatter for Structured Text. STweep is fully configurable and helps you team to produce consistent high quality code. STweep is available as plugin for TwinCAT and Code sys. Visit this site to learn more: https://www.stweep.com/