Program Structure - prologue section
Posted: Sun Nov 21, 2021 11:38 pm
The main section can be preceded by a prologue section also known as the declaration section. In the prologue section only declarations and initial definitions are allowed, such as the declaration of procedures, constants and variables. The prologue section is not marked by special block delimiters, but rather by the fact that the statements are placed before the main section:
Statements in the wrong section will generate an ‘illegal statement’ error. For example, in the above example, the print statement is not allowed in the prologue section. Likewise, the const statement is not allowed in the main section.
Code: Select all
' SharpBASIC – Hello world ' ------------------------ const msg = “hello world”; main do print(msg); end