Page 132 - Plus V4 with Adobe class 7
P. 132

Program 2: To demonstrate the if statement














        On running the above program, we get the following output:






















        The if…else Statement

        The  if…else  statement checks for a condition.  If  the            Test Expression
        condition  evaluates to  True, the  indented  block  following
        the if statement is executed, otherwise the indented block                  True                  False
        after the else statement is executed. The syntax of the if…
        else statement is given below:
                                                                               Body of if          Body of else
        Syntax:

        if (Test Expression):

            Indented block                                               Statement just below if
        else:

            Indented block

          Program 3: To compare two numbers and print the result



















            130  Plus (Ver. 4.0)-VII
   127   128   129   130   131   132   133   134   135   136   137