home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
pascal
/
pascsrc.arc
/
IFDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-15
|
1KB
|
38 lines
(* Chapter 4 - Program 2 *)
program Demonstrate_Conditional_Branching;
var One,Two,Three : integer;
begin (* main program *)
One := 1; (* these are to have some numbers *)
Two := 2; (* to use for illustrations *)
Three := 3;
if Three = (One + Two) then (* Example 1 *)
Writeln('three is equal to one plus two');
if Three = 3 then begin (* Example 2 *)
Write('three is ');
Write('equal to ');
Write('one plus two');
Writeln;
end;
if Two = 2 then (* Example 3 *)
Writeln('two is equal to 2 as expected')
else
Writeln('two is not equal to 2... rather strange');
if Two = 2 then (* Example 4 *)
if One = 1 then
Writeln('one is equal to one')
else
Writeln('one is not equal to one')
else
if Three = 3 then
Writeln('three is equal to three')
else
Writeln('three is not equal to three');
end. (* main program *)