1 00:00:00,110 --> 00:00:05,810 The while loop will look through a block of code as long as a specified condition is met. 2 00:00:05,820 --> 00:00:12,570 Let's take a look at an example we'll create a script that outputs the values of a variable as long 3 00:00:12,570 --> 00:00:16,080 as the value does not exceed 20. 4 00:00:16,140 --> 00:00:19,800 We will start by creating a variable to store our initial value 5 00:00:25,560 --> 00:00:26,690 we'll call this variable. 6 00:00:26,700 --> 00:00:27,030 I 7 00:00:29,910 --> 00:00:40,350 will assign the value zero to this variable. 8 00:00:40,360 --> 00:00:42,280 Now we can create our while loop 9 00:00:54,520 --> 00:01:02,140 here we've instructed our script to output the value of i as long as the value does not exceed 20 The 10 00:01:02,140 --> 00:01:09,790 while loop will loop over and over 19 times in this case each time it will output the value of I started 11 00:01:09,790 --> 00:01:12,880 at 0 and incremented by 1 12 00:01:16,370 --> 00:01:19,340 so let's go ahead and save this file and preview it in our web browser 13 00:01:25,310 --> 00:01:27,960 so we can see that the value starts at 0. 14 00:01:27,980 --> 00:01:33,650 That's the initial value of AI and it's incremented by 1 up until nineteen 15 00:01:36,290 --> 00:01:42,400 we can modify our script if we adjust our maximum value to 40 16 00:01:47,120 --> 00:01:50,540 we can now see that it goes up to thirty nine 17 00:01:55,230 --> 00:01:59,940 we can also adjust the value of AI if we wanted to start the incrementing it fine 18 00:02:06,720 --> 00:02:08,370 and that is how the while loop works.