Basic <-> Object Pascal | Podmienený príkaz
Basic Použitá kľúčové slová: if else then end
if then end if, if then else end if
Popis
if condition then
statements1
end if
if condition then
statements1
else
statements2
end if
Vstup
- condition - Logická hodnota Podmienkou môže byť akýkoľvek výraz
- statements1 - Príkazy
- statements2 - Príkazy
Príklady
Basic
Možné požitie Podmienený príkaz:if i > 10 then
i =10
i = i - 1
i=i+1
end if
if i < 10 then
i = 10
else
i=1
end if
.
Object Pascal Použitá kľúčové slová: if else then
if then, if then else
Popis
if condition then statement1;
if condition then statement1 else statement2;
Vstup
- condition - Logická hodnota Podmienkou môže byť akýkoľvek výraz
- statement1 - Príkazy
- statement2 - Príkazy
Príklady
Object Pascal
Možné požitie Podmienený príkaz:if i > 10 then
begin
i :=10; i := i - 1; inc(i);
end;
if i < 10 then i := 10 else i:=1;
Podmienený príkaz v inom programovacom jazyku:
Rozdiely oproti:
Zdieľať