Day12
Repetition
Today I learned to repeat commands, for example, if you want the object to say Meow, but more than once.
First, before repeating, we have to choose a command to make a sound, which is play sound, in order to say meow.
Now, if I wanted, for example, to repeat it three times, I could enter the same command three times, but you would do it successively and quickly.
I can create a delay between each command through the wait command and set the number of seconds I want.
But programming and algorithms in general do not depend on reaching the solution only, but rather reach the solution in the best possible way, and entering the same code several times manually is not the best way, so there are two things.
forever repeat
Repeat is to repeat the command a number of times that I specify, while forever is to repeat the command an infinite number of times.
This is an example if you want to repeat the matter three times.
Comments
Post a Comment