Page 107 - TechPluse_C7_Flipbook
P. 107

Program 2: To check if a number is positive.


















                 Program 3: To check if a number is greater than 10.

















                 IF-THEN-ELSE Statement


                 The IF-THEN-ELSE statement checks for a condition. If the condition evaluates to true, the indented
                 statements following the if statements are executed, otherwise the indented statements following
                 the else statement are executed. The syntax of the IF-THEN-ELSE statement is given below:

                 Syntax:
                 IF <condition> THEN                                                       Is
                                                                               No                   Yes
                      Statements to be executed                                        condition
                                                                                          true
                 ELSE
                                                                        Execute                         Execute
                      Statements to be executed                      commands in                     commands in
                 END IF                                             the ELSE block                    the IF block



                 Program 1: To check whether you are eligible to vote.



















                                                             Conditional and Looping Statements in BASIC-256         105
   102   103   104   105   106   107   108   109   110   111   112