Page 45 - Touchcode_C7_Flipbook
P. 45

Coding           uiz   01                                                          Critical Thinking



                    State whether the following statements are true (T) or false (F).

                    a.  Function is a block of code.

                    b.  Function helps to maximize errors.








                                          Coding fact

                   Frances Elizabeth Allen is the first woman to become an IBM Fellow and in

                   2006 she won the Turing Award.








                 HOW TO REDUCE REDUNDANCY USING FUNCTIONS?
                 Redundancy means when you do not repeat the same lines of code throughout the code
                 and use functions in places of those lines of code, and you are avoiding the redundancy

                 that you may have created by not using functions.

                 Consider an example of getting ready for school.

                 Getting ready to go to school involves six main steps:
                 Step 1:  Wake up early in the morning.

                 Step 2:  Brush your teeth.
                 Step 3:  Take a bath.

                 Step 4:  Eat your breakfast.

                 Step 5:  Pack your school bag.
                 Step 6:  Go to school.

                 Although the action ‘Getting ready for school’ constitutes only six steps, yet while describing
                 your day-to-day life routine to someone else, you will use the phrase like ‘Getting ready for

                 school’. This action of ‘Getting ready for school’ is easy for the other person to understand
                 and covers up the above given six steps in a single action. So, every time when you include
                 ‘Getting ready for school’ in your routine, it will automatically cover the above given six
                 steps.



                                                                                           Fun with Functions    43
   40   41   42   43   44   45   46   47   48   49   50