Powered By Blogger

Monday, March 7, 2016

IF CLAUSE

Let's learn how to use 'IF CLAUSE' in 

Turbo Pascal

  • If clause is used in 3 types.

  • IF/THEN/ENDIF
    IF/THEN/ELSE/ENDIF
    NESTED IF
 I WILL TEACH YOU HOW TO USE 'IF/THEN/ENDIF' TYPE IN THIS ARTICLE

  Here is the pascal code for finding a number greater than 10. try this program.

PROGRAM LRG_TEN;
VAR NUM: INTEGER;
BEGIN
WRITELN('ENTER THE NUMBER');
READ(NUM);
IF NUM>10 THEN;
WRITELN('NUMBER IS GREATER THAN TEN');
READLN;
END.

In the above program you can see there is a line as 'IF NUM>10 THEN'. This shows the condition that is need to be proved. The user will see as'NUMBER IS GREATER THAN TEN' if the condition is fulfilled.  But there is a disadvantage of using this case. The disadvantage is the user can't see anything if the condition is not fulfilled. You can learn how to use the  IF/THEN/ELSE/ENDIF case in my next article.

1 comment: