General Rules

PureBasic has established rules which never change. These are :

- Comments are marked by ; . All text entered after ; is ignored by the compiler.

Example :
If a = 10 ; This is a comment to indicate something.

- All functions must be followed by a ( or else it will not be considered as a function, (even for null parameter functions).

Example :
WindowID()
is a function.
WindowID
is a variable.

- All constants are preceded by #

Example :
#Hello =
10 is a constant.
Hello =
10 is a variable.

- All labels must be followed by :

Example:
I_am_a_label:

- An expression is something which can be evaluated. An expression can mix any variables, constants, or functions, of the same type. When you use numbers in an expression, you can add the $ sign in front of it to mean a hexadecimal number, or a % sign sign to mean a binary number. Without either of those, the number will be treated as decimal. Strings must be enclosed by inverted commas.

Examples of valid expressions :
a+1+(12*3) a+WindowHeight()+b/2+#MyConstant
a <> 12+2 b+2 >= c+3

a.s=b.s+"this is a string value"+c.s
foo + $69 / %1001; Hexadecimal and binary number usage

- Any number of commands can be added to the same line by using the : option.

Example :
If OpenScreen(0,320,200,8,0) : PrintN("Ok") : Else : PrintN("Failed") : EndIf

- Words used in this manual :

<variable> : a basic variable.
<expression> : an expression as explained above.
<constant> : a numeric constant.
<label> : a programme label.
<type> : any type, (standard or structured).

- In this guide, all topics are listed in alphabetical order to decrease any search time.