Repeat () Block
repeat () Block
Blocks inside the repeat block will loop a given amount of times, before allowing the script to continue. If a decimal is an input, the number is rounded up.
E.g. you can make a script to make Tobi recite a table of a number that the user gives him. You know what? Let’s make it!
Activity: Tobi Reciting Table
- Add an ask () and wait block to get the number whose table the user wants Tobi to recite.
- Make a variable and set it to 0.
- Add a repeat block and write 10 in its space as we want Tobi to say from 1 to 10.
- Add a change () by () block to increment the value each time the repeat block is called.
- Next, make Tobi recite the table by using the blocks shown in the script below.
- Finally, add a when flag clicked block above the entire script.
forever Block
Blocks inside the forever block will run in a loop just like the repeat () block except that the loop never ends. Since the loop is infinite, the block has no bump at the bottom; having a bump would be pointless, as the blocks below it would never be activated.
Assignment
Before you move on to the next lesson, a small assignment awaits you!
You must upload the PictoBlox program you wrote in the activity to the website.
Submitting the assignment is a must in order to receive the certificate after completing the course.
Follow the steps below to upload your assignment:
- Click on Choose File.
- Select the image from the pop-up window that opens up.
- Once the image is selected, click on Upload Assignment.
Good luck!