If you already know another language and want to check out Profan 'in a nutshell', this page is for you!
The formal elements
Formally each line must start with a command, followed by its parameters (if any).
In the parameters functions and variables can be used.
A function represents a value and usually has parameters of its own that determine the value.
For example @Add(2,var%) is the function that represents the value of var% plus 2.
Modifying a variable is done with LET var% = @Add(2,var%).
In certain cases this formal notation can be deviated from: var% = var% + 2 is also valid, but the more sophisticated functions don't have equivalent operators.
There are 4 types of parameters and variables: int%, longint&, float! and string$.
A variable has to be declared before it can be used.
All commands and functions can be found in Profan's reference, including their parameters and result.
The reference also documents the special system variables that Profan provides.
Conditions and loops
The most basic conditional command is CASE:
| CASE 0:PRINT "-" |
CASE 1:PRINT "+" |
CASE 5:PRINT "+" |
| CASENOT 0:PRINT "+"
|
CASENOT 1:PRINT "-"
|
CASENOT 2:PRINT "-" |
The table shows which commands will be executed (+) and which will not (-). IF...ENDIF works just like CASE, except that it allows multiple commands to be executed instead of one, and it can work with ELSE / ELSEIF constructions.
WHILE...ENDWHILE (or WEND) loops all commands in between as long as the condition after WHILE is met.
Of course IFNOT and WHILENOT are also available.
The most important conditional function is @Equ(A,B) which is 1 when A=B and 0 when not.
It can be replaced by the = operator. Related functions are @Equ$ for strings and @Neq, short for the inverse @Not(@Equ).
But basically any function can be used as condition: the main rule is that 0 will not execute and 1 will (or vice-versa for -NOT commands).
More coming...
|