IWML depends on strict indentation. While not inspired by other langauges, the use of indentation to denote blocks is not unique to IWML and is found in Python and other languages.
While usage of indentation may seem foreign to many, it greatly simplifies and makes the reading of IWML much cleaner. Even if you are among those who find it unusual, you will adapt quickly to it and likely become fond of it simplicity.
All blocks in IWML denote their children by an indent of exactly 2 spaces. Not a tab character, but exactly 2 spaces. Use of a tab character will result in an error. Don’t worry, the error is clear and tells you that tab characters are not valid and not some random unrelated error.
In this example we have taken the previous IWML and replaced the spaces with the = character to illustrate:
ACORN 1.0 IWML 1.0 Page ==SimpleStack ====Text Hello ====Text World ====Button Ok
Many editors such as Notepad++ and Visual Studio Code are extremely useful as they add vertical guidelines to IWML files.
Blocks are begun by simply indenting the following line by 2 spaces as shown in the previous example.
Blocks are closed by simply reducing the indent to match the statement which owns the block. Multiple closures may be rolled up into one by reducing the indent multiple times in a single line.
Explicit Block Closure
Explicit closures of blocks is also permitted by using the ] character. If used, it must exist using the same indent of the block that you wish to close.
Thus, this code is identical to the previous example:
ACORN 1.0 IWML 1.0 Page SimpleStack Text Hello Text World Button Ok ] ]
By default we will use the compact syntax, however some users may prefer the more explicit syntax and both syntax are fully supported. Many of our own demos still use the longer explicit syntax.
The ] character is optional for any line and is not a global document setting. Thus the following is also the same as above:
ACORN 1.0 IWML 1.0 Page SimpleStack Text Hello Text World Button Ok ]