Hoppa till huvudinnehåll

4.0 TRSE 101

In this part, some of the basics of TRSE is going to be described; Some useful syntax and some example code.

4.1 Syntax

  • Semicolons ends a row of code
foobar:=foo+bar; 
  • Blocks of code starts with begin and ends with end
begin 
foo:=true;
end;

NOTE: There is no semicolon after a begin expression

4.1.1 Assignment and Declaration

Declaration
variable_name: variable_type = value; 				

NOTE: You can create a variable without giving it a value. Itis done as follows:

variable_name: variable_type;
Assignment
variable_name:= value; 

4.2 Procedures & Functions

procedure xyxzy(parameter:type);         function do_stuff (parameter: type) : return_type;
begin begin
parameter:=parameter+1;
if (foo>0) then do_stuff:= parameter; <---(Returns value of function)
begin end;
bar:= true;
end
else if(foo > 10)
begin
baz:=true;
end
begin
foobar:=true;
end;
end;

NOTE: There is no semicolon after end if there is an else statement after.


You can always visit the TRSE for more help with syntax Lemonspawn.com/TRSE