Program Structure - prologue section

information about SharpBASIC language elements
Post Reply
User avatar
frank
Site Admin
Posts: 51
Joined: Sun Nov 21, 2021 12:04 pm
Location: Netherlands
Contact:

Program Structure - prologue section

Post by frank »

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:

Code: Select all

' 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.
Keep it simple!
Post Reply