1
00:00:00,180 --> 00:00:06,390
Let's continue on the process of looping the previous video you talk about for Loop.

2
00:00:06,689 --> 00:00:11,460
And we have one type which is called the Y loop.

3
00:00:11,580 --> 00:00:15,780
So they are based on the same logic but a syntax which differs.

4
00:00:15,780 --> 00:00:21,800
So let me comment out this one and the next one I'm going to be asked next loop.

5
00:00:21,810 --> 00:00:25,590
Loop number two is called do y a y loop.

6
00:00:25,590 --> 00:00:28,110
Sorry, is y.

7
00:00:28,980 --> 00:00:29,820
While.

8
00:00:30,650 --> 00:00:31,220
Loop.

9
00:00:31,790 --> 00:00:41,030
So what it centers the wild loop is similar to the for loop, but instead of using an initialize and

10
00:00:41,030 --> 00:00:47,450
an incremental, it is only or it has a condition only.

11
00:00:47,690 --> 00:00:53,120
The code block is executed repeatedly until the condition evaluates to false.

12
00:00:53,330 --> 00:00:57,320
So while loop don't have initialize, it doesn't have incremental.

13
00:00:57,890 --> 00:00:59,590
So why?

14
00:00:59,600 --> 00:01:01,030
How can you write that?

15
00:01:01,040 --> 00:01:02,360
So let's save it.

16
00:01:02,630 --> 00:01:08,870
And now let's write a syntax for why we bring in while in the parentheses like that they might carry

17
00:01:08,870 --> 00:01:09,550
braces.

18
00:01:09,560 --> 00:01:12,530
So here we declare a variable.

19
00:01:13,010 --> 00:01:18,140
Let's I let's I equal to zero up here.

20
00:01:18,440 --> 00:01:21,620
So inside my wild loop is my condition.

21
00:01:21,830 --> 00:01:28,940
So if I is less than ten then the code here is going to run.

22
00:01:28,940 --> 00:01:31,250
Then we can cancel that log.

23
00:01:32,330 --> 00:01:34,550
Consulate log the I.

24
00:01:34,850 --> 00:01:43,010
So if I save this one, our application is going to crash or freeze because it's going to be always

25
00:01:43,010 --> 00:01:43,580
true.

26
00:01:43,580 --> 00:01:47,840
Always to want to run round, round, round, round, round, round, round, round until our browser

27
00:01:47,840 --> 00:01:49,430
cannot hold the data anymore.

28
00:01:49,610 --> 00:01:54,260
So to avoid that, we are going to increment the value down here.

29
00:01:54,920 --> 00:02:01,490
So I'm going to make it plus plus I meaning we are increasing I at every loop so that this condition

30
00:02:01,490 --> 00:02:03,890
can be forced at any point in time.

31
00:02:04,130 --> 00:02:14,510
So if I save it now, I have some syntax error so I need to make it a is I but not I mean one.

32
00:02:14,510 --> 00:02:23,660
So we see that I have 0 to 9 because the same process I add for this one, it has no initialize, it

33
00:02:23,660 --> 00:02:27,620
has no incremental, but it has a condition that is y loop.

34
00:02:27,740 --> 00:02:31,940
So depending how you want it, then you can go for for loop or while loop.

35
00:02:31,940 --> 00:02:35,600
But for loop is commonly used because that one is more flexible.

36
00:02:35,720 --> 00:02:42,560
And for that one tool, we can make it to this sentence, which is more flexible than the while, but

37
00:02:42,560 --> 00:02:45,890
all of them depends on the logic of your application.

38
00:02:46,770 --> 00:02:50,190
So that's differences between the for loop and wild loop.

39
00:02:50,400 --> 00:02:55,740
The next video, let's talk about one loop, which is also called the Y.

40
00:02:55,830 --> 00:02:59,730
I mean, I think, yeah, we have many of but I think we have this tool.

41
00:03:01,430 --> 00:03:01,850
All right.

42
00:03:01,850 --> 00:03:04,890
So we just had a basic loop that we come across as we move on.

43
00:03:04,910 --> 00:03:06,830
We'll be exploring more of the loops.

