elna/example.elna

82 lines
921 B
Plaintext

type
T = array 5 of Int,
R = record
x: Int;
y: Int
end;
const t = 5;
proc test_string();
var s: String;
begin
s := "Test string.";
writei("");
writei(s)
end;
proc test_array();
var a: T, x_3: Int;
begin
a[0] := 2;
a[1] := 5;
writei("");
writei("Test array:");
x_3 := 0;
while x_3 < 2 do
begin
writei(a[x_3]);
x_3 := x_3 + 1
end
end;
proc test_pointer();
var x_2: Int, p: ^Int;
begin
x_2 := 5;
p := @x_2;
writei("");
writei("Test pointer:");
writei(p);
writei(p^)
end;
proc test_record();
var r: R;
begin
writei("");
writei("Test record:");
r.x := 4;
r.y := 8;
writei(r.y)
end;
var x_1: Int, y: Bool, z: Float, c: Char;
begin
z := 8.2;
x_1 := t;
y := false;
c := 'x';
if y then
z := z + 3.0
else
z := z + 2.0;
writei(z);
writei(x_1);
writei(c);
test_string();
test_array();
test_pointer();
test_record()
end.