December 2019
Beginner
464 pages
10h 31m
English
In This Chapter
• Learn how to have some code run repeatedly
• Work with for, while, and do...while loops
When you are coding something, there will be times when you want to repeat an action or run some code multiple times. For example, let’s say we have a function called saySomething that we want to repeatedly call 10 times.
One way we could do this is by simply calling the function 10 times using copy and paste:
saySomething(); saySomething(); saySomething(); saySomething(); saySomething(); saySomething(); saySomething(); saySomething(); saySomething(); saySomething();
This works and accomplishes what we set out to do, but...we shouldn’t do something like this. After ...