Page 106 - TechPluse_C7_Flipbook
P. 106

Decision-making in programming is similar to real-life choices, where actions depend on
                      conditions.
                      Programs execute specific statements based on true or false outcomes, ensuring structured
                      and logical flow.


                      CONDITIONAL STATEMENTS

                  Decision making in BASIC-256 is done by conditional statements or decision-making statements
                  which decide the direction of the flow of program execution. Since they control the execution of
                  the program, you also call them Control statements. Control statements available in BASIC-256
                  are given below.

                      IF-THEN Statement


                      IF-THEN-ELSE Statement

                  IF-THEN Statement


                  The IF-THEN statement is the simplest conditional statement. Here, certain statement or block
                  of statements within the if block is executed only if specified condition evaluates to true. If the
                  condition evaluates to false, then the control of execution is passed to the last statement, outside
                  the if block.

                  The syntax of the IF-THEN statement is given below.
                                                                                                          Execute
                                                                                       Is
                                                                                                Yes     statement(s)
                  Syntax:                                                          condition
                                                                                     true
                  IF <condition> THEN
                    Statements to be executed                                     No



                  END IF                                                        Statement after
                                                                                     END IF
                  Program 1: To demonstrate IF-THEN statement.

























               104      Premium Edition-VII
   101   102   103   104   105   106   107   108   109   110   111