Page 60 - Touchcode_C5_Flipbook
P. 60

4.2                              PROGRAMS : CONDITIONS











                  IF..THEN..ELSE

                  While writing programs we need to make certain decisions based on the logic of the
                  program. In such cases we need a conditional.

                  If..then..else is a conditional statement. It is used to make the programs to be able

                  to make decisions. For example:


                                                If number is divisible by 2

                                                Then


                                                      Print “The number is EVEN”

                                                Else

                                                      Print “The number is ODD”



                  In the above example, if the numbers is divisible by 2 the result will be “The number
                  is EVEN”. Whereas, if the number is not divisible by 2, the result will be “ The number

                  is ODD“

                  Write the If..then statements for the following imaginary conditions. One has
                  been done for you.

                         1    What would happen if … there were no computers, tablets, or phones of

                             any kind anywhere on Earth?



                               If  there were no computers, tablets, or phones of any kind
                                  anywhere on Earth

                               Then

                                      We  would  have  slower  means of  communications  and

                                     we would not be as advanced as now.








                   58      Touchcode–V
   55   56   57   58   59   60   61   62   63   64   65