IF...THEN...ELSE

Program Marks

uses crt

var a,b, average: real;

Begin

clrscr

writeln('Your two marks are:');

readln(a,b);

average= (a +b)/2;

writeln('Your average is:');

if average >=50

   write('You Passed! Good Job!')

else write ('You failed, sorry');

readln

End.

 The conditional instruction is for acting intelligently, taking one or more actions if a condition is met and other action(s) if another condition is met. For example: So, the syntax is:

if then else 

If there are more commands to execute, they will be grouped in BEGIN ... END. If after IF's command (or the END if there are more commands) there is the ELSE statament, then there must be no semicolon after the previous word.

From Borland Pascal Wiki, a Wikia wiki.