Object Pascal - Conditional statement: if then, if then else

By conditions we can control our program. thanks conditional statement we can control program running in two directions. if the condition is satisfied to continue running the program in a first direction, if not as the second direction. under the directions of the programme I think either statement or block of statements.

if then, if then else

Description

if condition then statement1;
if condition then statement1 else statement2;
Used keywords: if else then

Input

Examples

Object Pascal

Conditional statement the possible of use:
if i > 10 then
begin
i :=10;            i := i - 1;   inc(i);
end;
if i < 10 then i := 10 else i:=1;

Object Pascal

Other pieces of example codes:
while i>0 do
   if i=10 then
     break
   else 
   begin
     dec(i)
   end;
if  x >= 12 then
   while  y >= 0 do  
      dec(y);
if  x = 5 then
   dec(y);
if y<5 then
   y := y/ 3.14;    // y = 1.234
if x>$abc then
  y := x / $a;    // y = 466
if  y < 100 then  
   inc(x);
Languages: en hu cz sk