Page 51 - Touchcode_C7_Flipbook
P. 51

Step 4:  Click on ‘Function’, select
                            ‘Make a Function’. Name
                            the function ‘Touchcode-7’,
                            Click on ‘Number’, and

                            name it as ‘Radius’.

                  Step 5:  Click on ‘Done’. Function
                            ‘Touchcode-7’, will appear on workspace.

                  Step 6:  Create another variable with the name ‘Area of a circle’. Click on the ‘set Area of a
                            circle to 0’ block. Place the ‘set Area of a circle to 0’ block inside the ‘function’ block.













                  Step 7:  From the ‘Math’ select the two ‘Multiplication’ block. Drag one multiplication block
                            to another, and make it Multiplication of three numbers. Drag the multiplication

                            blocks and drop it to the ‘function’ block, inside the ‘set Area to 0’ block.

                  Step 8:  From  the  ‘Variable’  select
                            two ‘Radius’ blocks. Drag the
                            ‘Radius’ block and drop it to
                            ‘0’ of the ‘set Area to 0’ block.
                            Change the value of ‘0’ to 3.14.


                  Step 9:  From ‘Game’, select ‘splash’ block.  Click on ‘Advanced’, select ‘Text’, and then
                            click on ‘join’ block. Drag the ‘join’ block and drop it to the ‘splash’ block.

                  Step 10: Write the message ‘Area of a circle is:’ in ‘hello’ and in ‘world’ drag the variable
                            ‘Area of a circle, and drop it in a ‘join’ block.

                  Step 11: Drag the ‘splash’ block and drop it to the ‘function block, below the ‘set Area of a
                            circle’.

                  Step 12: From the ‘function’, select the ‘call
                            Touchcode-7’.  From the ‘Variable’

                            select the  ‘Radius’,  drop  it to the
                            block  ‘Touchcode-7’  block. Drop
                            the ‘call Touchcode-7’ block to the
                            ‘on start’ block.


                                                                                           Fun with Functions    49
   46   47   48   49   50   51   52   53   54   55   56