A Tab key can be used to indent a statement.
Tidy programs have statement blocks indented by one tab.
If a for loop needs to repeat a single statement only, a statement list can be used instead of a statement block.
A statement list begins with a colon (:) symbol.
Statement lists are a feature of ZedLX. They are not available in most other programming languages.
Statements of a statement list must be separated by colon (:) symbols. A semicolon (;) symbol ends a statement list.
A statement list can contain many plain statements. The last statement of a statement list can be any statement.
Plain statements are statements that must always be ended by a semicolon (;) or colon (:) symbol. A println statement is a plain statement.
A for statement is not a plain statement, because it can end with a statement block.
Here is the same program written in a disorderly manner.
Why doesn't this code make a pause on each iteration?
A semicolon (;) symbol ends a statement list. In this case, there is a semicolon at the end of the println statement. Therefore, the sleepMs statement is not part of the statement list, thus it is outside the for loop.
The code is badly indented. It looks like the sleepMs statement is a part of the loop, but it isn't.
How would you make the sleepMs statement be a part of the statement list?
for #i=1..20 : println i*i << NOT ended by semicolon : sleepMs(200);
The text between symbols /* and */ is called a multiline comment. A multiline comment can span multiple lines.
Rewrite this demonstrational program so that a statement list is used instead of the statement block.
Run this demonstrational program that draws a strange shape.
Additional chapter Graph Drawing is available. It explains how to draw graphs of mathematical functions.
If you are interested in drawing graphs of functions, click on the following link: