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:
' SharpBASIC – Hello world
' ------------------------
const msg = “hello world”;
main do
print(msg);
end
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.
Last edited by frank on Wed Mar 09, 2022 2:51 pm, edited 1 time in total.