Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 37 - 2501_KVS_C-4
P. 37

    Aryan: Wow!!! That’s so interesting dear. Now we can make stories, dramas with
                        sounds also. In the above activity 3.1, you have changed the volume or pitch of the
                        sound of the sprite 4 times by writing the same code 4 times again and again. What
                        if I want to do it 50 times. Will I have to write it 50 times?

                        Gowri: No dear, there are blocks which can repeat the script written inside it any number of
                        times you want. Let’s learn it today.

                     3.3 LOOPING—“CONTROL” BLOCK

                     3.3.1 “Repeat 10…” block

                     This is also known as “c-block”, which is used to repeat the blocks of
                     instructions for some specific number of times.

                     3.3.2 “Repeat until…” block

                     This is also known as “c-block”, which is used to repeat the blocks
                     of instructions till some condition is false. If the condition becomes
                     true, then it runs the next instructions written after the “repeat”

                     block.
                        Aryan: What is this “c-block”? Please explain it.

                                      Gowri: Sure dear! “c-block” means these blocks are in the shape of “c character”
                                      of English alphabets. These blocks can have any number of statements written
                                      inside it

                                      Aryan: Ok, dear, now could you please explain me, what is the “condition”?

                                      Gowri: Sure dear! Ok, please tell me the answers to some questions I am asking
                                      to you.
                                      1.     Is 4+5=9?
                                      2.     Are you studying in class 4?
                                      3.     Are you going to school daily?

                                      Aryan: “Yes”, is the answer of all these questions. But why are you asking these
                                      questions to me?

                        Gowri: Yes, because all these questions are having some answers and based on
                        those answers, I will make decisions. So, all these questions will become conditions.
                        And answers to these questions are in the form of “yes” or “no” only. If I want to
                        make some decisions based on a question, then the question becomes condition.

                        Aryan: WOh! I come to understand now, what are the “conditions”? Thanks, dear
                        Gowri, for explaining this to me.

                        Gowri: Let’s learn “repeat until…” in detail with the help of an activity.

                                                                                          Scratch                       35

| 32 33 34 35 36 37 38 39 40 41 42 |