1. IF
a)
$a := 0;
if ($a == 0) then
begin
echo $a
end
b)
$a := 0;
if ($a == 1) then
begin
echo $a
end
c)
$a := 0;
if ($a < 1) then
begin
echo $a
end
d)
$a := 0;
if ($a > 1) then
begin
echo $a
end
e)
$a := 0;
if ($a != 1) then
begin
echo $a
end
f)
$a := 0;
if ($a <= 1) then
begin
echo $a
end
g)
$a := 0;
if ($a >= 1) then
begin
echo $a
end
h)
$a := 0;
if ($a <= 1) then
begin
echo $a
end
i)
$a := 0;
if ($a >= -1) then
begin
echo $a
end
j)
$a := 0;
if ($a <= -1) then
begin
echo $a
end
1. IF-ELSE
a)
$a := 0;
if ($a == 0) then
begin
echo $a
end
else
begin
echo 2
end
b)
$a := 0;
if ($a == 1) then
begin
echo $a
end
else
begin
echo 2
end
c)
$a := 0;
if ($a < 1) then
begin
echo $a
end
else
begin
echo 2
end
d)
$a := 0;
if ($a > 1) then
begin
echo $a
end
else
begin
echo 2
end
e)
$a := 0;
if ($a != 1) then
begin
echo $a
end
else
begin
echo 2
end
f)
$a := 0;
if ($a <= 1) then
begin
echo $a
end
else
begin
echo 2
end
g)
$a := 0;
if ($a >= 1) then
begin
echo $a
end
else
begin
echo 2
end
h)
$a := 0;
if ($a <= 1) then
begin
echo $a
end
else
begin
echo 2
end
i)
$a := 0;
if ($a >= -1) then
begin
echo $a
end
else
begin
echo 2
end
j)
$a := 0;
if ($a <= -1) then
begin
echo $a
end
else
begin
echo 2
end
3. WHILE DO
3.1. Kleiner
$a := 0;
while $a < 10 do
begin
echo $a;
$a := $a+1
end;
3.2. Kleiner gleich
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := $a+1
end;
3.3. Multiplikation
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := $a*2
end;
3.4. Multiplikation
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := 2*$a
end;
3.5. Multiplikation, komplizierte Terme
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := $a*2+4
end;
3.6. Multiplikation, komplizierte Terme
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := 4+$a*2
end;
3.7. Multiplikation, komplizierte Terme
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := (4+$a)*2
end;
3.7. Multiplikation, mehrere Variablane
$a := 0;
$i := 0;
while $i < 10 do
begin
echo $a;
$a := (4+$a)*2
$i := $i+1;
end;
3.8. Kompliziert
$a := 0;
$i := 0;
while $i+$a < 10 do
begin
echo $a;
$a := $a*2
$i := $i+1;
end;
3.9 Verschachtelte Schleifen
$i := 0;
while $i < 10 do
begin
$j := 0;
while $j < 10 do
begin
echo $j;
echo $i;
$j := $j+1
end
$i := $i+1
end
3.10. Arrays
$i := 0;
while $i < 10 do
begin
$a [$i] = sin ($i);
$i := $i+1
end;
$i := 0;
while $i < 10 do
begin
echo $a [$i];
$i := $i+1
end
3.11. Mehrdimensionale Arrays
$i := 0;
while $i < 10 do
begin
$j := 0;
while $j < 10 do
begin
$a [$i][$j] = $i*10+$j
$j := $j+1;
end;
$i := $i+1
endd
3.12. Sortieralgorithmus
$i := 0;
$a [0] := 12;
$a [1] := 8;
$a [2] := 1;
$a [3] := 7;
$a [4] := 9;
$a [5] := 2;
$a [6] := 6;
$a [7] := 10;
$a [8] := 4;
$i := 0;
while $i < 9 do
begin
$j := $i+1;
while $j < 9 do
begin
if $a[$j] < $a [$i] then
begin
$tmp := $a [$i];
$a [$i] := $a [$j];
$a [$j] := $tmp
end;
$j := $j+1
end;
$i := $i+1
end
$i := 0;
while $i < 9 do
begin
echo $a [$i];
$i := $i+1
end
39. Ausdrücke
$tc := 5;
echo $tc;
$tb := 6;
echo $tb;
$ta := $tb + $tc;
echo $ta;
$ta := 2*($tb+$tc);
echo $ta;
$ta := (2*($tb+$tc)+4)*3;
echo $ta;
$tc := (5);
echo $tc;
$tb := (6);
echo ($tb);
$ta := ($tb + $tc);
echo ($ta);
$ta := (2*($tb+$tc));
echo ($ta);
$ta := ((2*($tb+$tc)+4)*3);
echo ($ta);
$tc := ((5));
echo $tc;
$tb := ((6));
echo (($tb));
$ta := (($tb + $tc));
echo (($ta));
$ta := ((2*($tb+$tc)));
echo (($ta));
$ta := (((2*($tb+$tc)+4)*3));
echo (($ta));
Jetzt mit dazwischen und am Ende:
1. IF
a)
$b := 5+5;
echo $b;
$a := 0;
if ($a == 0) then
begin
echo $a
end;
$c := 10+5;
echo $c
b)
$b := 5+5;
echo $b;
$a := 0;
if ($a == 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
c)
$b := 5+5;
echo $b;
$a := 0;
if ($a < 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
d)
$b := 5+5;
echo $b;
$a := 0;
if ($a > 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
e)
$b := 5+5;
echo $b;
$a := 0;
if ($a != 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
f)
$b := 5+5;
echo $b;
$a := 0;
if ($a <= 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
g)
$b := 5+5;
echo $b;
$a := 0;
if ($a >= 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
h)
$b := 5+5;
echo $b;
$a := 0;
if ($a <= 1) then
begin
echo $a
end;
$c := 10+5;
echo $c
i)
$b := 5+5;
echo $b;
$a := 0;
if ($a >= -1) then
begin
echo $a
end;
$c := 10+5;
echo $c
j)
$b := 5+5;
echo $b;
$a := 0;
if ($a <= -1) then
begin
echo $a
end;
$c := 10+5;
echo $c
1. IF-ELSE
a)
$b := 5+5;
echo $b;
$a := 0;
if ($a == 0) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
b)
$b := 5+5;
echo $b;
$a := 0;
if ($a == 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
c)
$b := 5+5;
echo $b;
$a := 0;
if ($a < 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
d)
$b := 5+5;
echo $b;
$a := 0;
if ($a > 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
e)
$b := 5+5;
echo $b;
$a := 0;
if ($a != 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
f)
$b := 5+5;
echo $b;
$a := 0;
if ($a <= 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
g)
$b := 5+5;
echo $b;
$a := 0;
if ($a >= 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
h)
$b := 5+5;
echo $b;
$a := 0;
if ($a <= 1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
i)
$b := 5+5;
echo $b;
$a := 0;
if ($a >= -1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
j)
$b := 5+5;
echo $b;
$a := 0;
if ($a <= -1) then
begin
echo $a
end
else
begin
echo 2
end;
$c := 10+5;
echo $c
3. WHILE DO
3.1. Kleiner
$b := 5+5;
echo $b;
$a := 0;
while $a < 10 do
begin
echo $a;
$a := $a+1
end;
$c := 10+5;
echo $c
3.2. Kleiner gleich
$b := 5+5;
echo $b;
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := $a+1
end;
$c := 10+5;
echo $c
3.3. Multiplikation
$b := 5+5;
echo $b;
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := $a*2
end;
$c := 10+5;
echo $c
3.4. Multiplikation
$b := 5+5;
echo $b;
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := 2*$a
end;
$c := 10+5;
echo $c
3.5. Multiplikation, komplizierte Terme
$b := 5+5;
echo $b;
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := $a*2+4
end;
$c := 10+5;
echo $c
3.6. Multiplikation, komplizierte Terme
$b := 5+5;
echo $b;
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := 4+$a*2
end;
$c := 10+5;
echo $c
3.7. Multiplikation, komplizierte Terme
$b := 5+5;
echo $b;
$a := 0;
while $a <= 10 do
begin
echo $a;
$a := (4+$a)*2
end;
$c := 10+5;
echo $c
3.7. Multiplikation, mehrere Variablane
$b := 5+5;
echo $b;
$a := 0;
$i := 0;
while $i < 10 do
begin
echo $a;
$a := (4+$a)*2
$i := $i+1;
end;
$c := 10+5;
echo $c
3.8. Kompliziert
$b := 5+5;
echo $b;
$a := 0;
$i := 0;
while $i+$a < 10 do
begin
echo $a;
$a := $a*2
$i := $i+1;
end;
$c := 10+5;
echo $c
3.9 Verschachtelte Schleifen
$b := 5+5;
echo $b;
$i := 0;
while $i < 10 do
begin
$j := 0;
while $j < 10 do
begin
echo $j;
echo $i;
$j := $j+1
end
$i := $i+1
end;
$c := 10+5;
echo $c
3.10. Arrays
$b := 5+5;
echo $b;
$i := 0;
while $i < 10 do
begin
$a [$i] = sin ($i);
$i := $i+1
end;
$c := 10+5;
echo $c
$i := 0;
while $i < 10 do
begin
echo $a [$i];
$i := $i+1
end;
$c := 10+5;
echo $c
3.11. Mehrdimensionale Arrays
$b := 5+5;
echo $b;
$i := 0;
while $i < 10 do
begin
$j := 0;
while $j < 10 do
begin
$a [$i][$j] = $i*10+$j
$j := $j+1;
end;
$i := $i+1
end;
$c := 10+5;
echo $c
3.12. Sortieralgorithmus
$b := 5+5;
echo $b;
$i := 0;
$a [0] := 12;
$a [1] := 8;
$a [2] := 1;
$a [3] := 7;
$a [4] := 9;
$a [5] := 2;
$a [6] := 6;
$a [7] := 10;
$a [8] := 4;
$i := 0;
while $i < 9 do
begin
$j := $i+1;
while $j < 9 do
begin
if $a[$j] < $a [$i] then
begin
$tmp := $a [$i];
$a [$i] := $a [$j];
$a [$j] := $tmp
end;
$j := $j+1
end;
$i := $i+1
end;
$c := 10+5;
echo $c
$i := 0;
while $i < 9 do
begin
echo $a [$i];
$i := $i+1
end;
$c := 10+5;
echo $c
39. Ausdrücke
$tc := 5;
echo $tc;
$tb := 6;
echo $tb;
$ta := $tb + $tc;
echo $ta;
$ta := 2*($tb+$tc);
echo $ta;
$ta := (2*($tb+$tc)+4)*3;
echo $ta;
$tc := (5);
echo $tc;
$tb := (6);
echo ($tb);
$ta := ($tb + $tc);
echo ($ta);
$ta := (2*($tb+$tc));
echo ($ta);
$ta := ((2*($tb+$tc)+4)*3);
echo ($ta);
$tc := ((5));
echo $tc;
$tb := ((6));
echo (($tb));
$ta := (($tb + $tc));
echo (($ta));
$ta := ((2*($tb+$tc)));
echo (($ta));
$ta := (((2*($tb+$tc)+4)*3));
echo (($ta));
Jetzt mit dazwischen und am Ende: