The While Loop

Learn how to repeat a code segment as many times as you want by using the while loop.

We'll cover the following


In order to execute the same expressions multiple times, we create loops.

Think of a loop like the song “Around the world, around the wo-orld. Around the world, around the wo-orld…”. You get the idea. Take a melody, repeat it a hundred times, and you get the song. In programming terms, take some code, repeat it x amount of times, and you get code executed a hundred times.

Let’s create a function that sums the values of an array:

Get hands-on with 1200+ tech skills courses.