Variables
To declare a global variable, you can do it just after the “program” line, or after any “procedure” or “function” line for a local variable. Please, avoid to declare reserved variables!
When you declare a variable you need to give it a type.
Supported types: Integer, String, WideString, Cardinal, TStringList, Boolean, Real, Word, Char (and some others)
Declaration:
var i: integer; s:string; a,b,c:boolean;
Assignation:
i:=2; s:='text'; a:=true; b:=false; c:=not (a);
Usage:
if ( (a=true) and (b=false) or (a<>c)) then begin SendRoom(s+' '+inttostr(i),b); end;
Loops
If (condition) then else:
normal usage:
if (x=1) then begin //do something end;
“else” usage:
if (x=1) then begin //do something end else begin //do something else end;
While (condition) do:
x:=0; while (x<10) do begin x:=x+1; //do something end;
Repeat until (condition):
x:=0; repeat x:=x+1; //do something until (x>=10);
For (loop) do:
for x:= 1 to 10 do begin //do something 10 times end;
Case Switch:
case (x) of 1:begin //do something if x equals 1 end; 2:begin //do something if x equals 2 end; default:begin //do something else if nothing above matches end; end;

