Page 73 - Touchcode_C7_Flipbook
P. 73

Experiential Learning
                     .......   Applied Project

                                                 To add an element in an array
                  To perform the task, follow these steps:

                  Step 1:   Visit the link: https://arcade.makecode.com/. Click on ‘New Project’. Write the name of
                            your project ‘add and print element to array..!!’, and then click on ‘Create’.

                  Step 2:   Create a variable, ‘list’.

                  Step 3:   From ‘Array’ select ‘set textlist to array of’ block.






                  Step 4:     Click on the dropdown arrow of ‘text list’, select ‘list’ and change its value to 1, 2 and
                            then drop the block to ‘on start’ block.











                  Step 5:   From the ‘Array’ select ‘list add value’ block, add the value as ‘5’. Drop ‘list add value’ to
                            ‘on start’ block below the ‘set list to’ block.










                  Step 6:   From  ‘Game’  select  the  ‘splash’  block.  From  ‘Array’  drag  the  ‘list  get  value  at’  block,
                            change the value of 0 to 2, as you will insert the element at the end of the array.
                  Step 7:   Drag and drop the ‘list get value at 2’ block and drop it to ‘splash’ block.







                  Step 8:   Drop the ‘splash’ block to ‘on start’ block.















                                                                            Understanding Arrays & Collections   71
   68   69   70   71   72   73   74   75   76   77   78