Page 31 - Touchcode_C8_Flipbook
P. 31
Step 4: From ‘Logic’ select ‘if-else’ block and drop it to the ‘on start’ block below the ‘set
num2 to 0 ‘ block. Click on ‘+’ to add one more ‘else’ block.
Step 5: From ‘Logic’ select the ‘comparison’ block and drop it to the ‘true’ of ‘if-else’ block.
Change the sign of ‘comparison’ block to ‘>’.
Step 6: From ‘Variables’ select ‘num1’ and ‘num2’ and drop it to either ‘0’ of ‘comparison’
block.
Step 7: From ‘Logic’ select the ‘comparison’ block and drop it to the ‘true’ of ‘if-else’ block.
Change the sign of ‘comparison’ block to ‘<’.
Step 8: From ‘Variables’ select ‘num1’ and ‘num2’ and drop it to either ‘0’ of ‘comparison’
block.
Step 9: From ‘Game’ select the ‘splash’ block. Write the
message ‘num1 is greater than num2’. Drop the
‘splash’ block in ‘if’ section.
Step 10: From ‘Game’ select the ‘splash’ block. Write the
message ‘num1 is lesser than num2’. Drop the
‘splash’ block in ‘else-if’ section.
Step 11: From ‘Game’ select the ‘splash’ block. Write the
message ‘num1 is equal to num2’. Drop the ‘splash’
block in ‘else’ section.
Get Creative with Loops 29

