Page 65 - Touchcode_C7_Flipbook
P. 65
Step 3: From toolbox, click on ‘Arrays’, and select ‘set list to
array’ block.
Step 4: In the ‘set list to array’ block, click on the drop-down
and select variable ‘a’. In the ‘set a to array if’ block,
write value=10, 20, in place of 0 and 1, and click on
‘+’ to add new values as 30, 40, 50. Move the ‘set list
to array’ block to ‘on start’ block.
Step 5: From ‘Array’ select ‘length of array’ block. In ‘length
of Array’ block, select ‘a’ from the drop down. Click
on ‘Text’, select the ‘join’ block. In ‘join’ block replace
the first text box with ‘Length of array is:’ and drop
‘length of array’ block in the second text box.
Step 6: From ‘Game’, select ‘splash’ block. Place the ‘join’ block in ‘splash’ block, and
Place the ‘splash’ block, in ‘on start’ block, below the ‘set list to array’ block.
Step 7: Click on the ‘Start the simulator’ button to see the output:
Well done, you have learned to create an array and calculate its length.
Understanding Arrays & Collections 63

