There are two kinds of conditional statement : if statement and case statement. This both statements are for making decisions that involve two or more alternative choices or conditions.
In this tutorial, we will learn about if statement. There are two kinds of if statement :
- if ….. then
- if ….. then …. else
The syntax of if …. then statement is :
If boolean expression then statement;
Boolean expression can be true or false. If it is true, computer will execute the statement. If it is false, computer will not execute the statement.
The syntax of if …. then …. else statement is :
If boolean expression then first_statement else second_statement;
If boolean expression is true, computer will execute the first statement. If it is false, computer will execute the second statement.
The flowchart of if statement is below :
Example for if …. then statement :
program Project1;
{$APPTYPE CONSOLE}
uses SysUtils;
var
score : integer;
begin
write('Your score : ');
readln(score);
if score < 60 then writeln('You did not pass the exam');
if score >= 60 then writeln('You passed the exam');
readln;
end.
Example for if …. then …. else statement :
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
score : integer;
begin
write('Your score : ');
readln(score);
if score < 60 then
writeln('You did not pass the exam')
else
writeln('You passed the exam');
readln;
end.
Both projects above will give you the same result.
Go to Previous Tutorial or Next Tutorial
Hiya! Do you happen to know how to verify that the content of your site is exclusive around the blogosphere and no other person is using it without making sure you are aware of it?
ReplyDeletesupplier of 3D printing, rapid prototyping, rapid manufacturing, plastic fabrication, tooling, CNC and injection molding services.
ReplyDeletes The best and a lot of secret drop-shipping suppliers in the world which will provide your products globally available for you directly to your customers doors. Also get the best drop-shipping manufacturer on your organization.
DeleteWe hebben ervaring in familie matrijzen, multi cavity matrijzen, meervoudige matrijzen, matrijzen met sliders. moulds voor insertmolding en matrijzen voor plastics, tpe/tpre rubbers en siliconen..
ReplyDeleteWe love IGES IGS STEP or Parasolid files of your rapid prototype
ReplyDeleteif you don not have your Cadfile finished we can assist you with creating 3dcadfiles which are necessity to program our sophisticated machinery.
Prototype is a Rapid Prototyping manufacturer in China mainland close to Hong Kong, our rapid prototyping services include: CNC, SLA,
Deletethanks :)
ReplyDelete