8.1 Loops Conceptually

Chapter Table of Contents

Ch. 8 Loops

Section Table of Contents

Throughout this course, there may have been times where you typed the same or very similar code multiple times. For instance, if I wanted to print “Hello World” 5 times, I would have to type System.out.println(“Hello World”) 5 times, and that sounds easy enough.But what if I wanted to do that 100 times? What about 1,000 times? At that point, you might’ve wished there was some structure that allowed you to repeat code. Fortunately, those structures do exist, and they’re called loops!Loops are great for repeating the same thing over and over again, also known as iteration. If you ever find yourself doing the same thing many times or copying and pasting the same code again and again, think to yourself, “Can I use a loop here?”The two loops that we will be talking about today (and also the most commonly used ones) are called for loops and while loops.

Next Section

8.2 For Loops


Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.