1 00:00:00,210 --> 00:00:03,810 Before we start, did you try solving the workbook yourself? 2 00:00:03,840 --> 00:00:09,600 If not, please click the link in the resources folder and follow the instructions for this workbook. 3 00:00:10,690 --> 00:00:12,820 Welcome to Workbook 5.1. 4 00:00:12,820 --> 00:00:16,930 Task one is to make a loop that prints the following message ten times. 5 00:00:16,930 --> 00:00:18,280 We will do just that. 6 00:00:18,280 --> 00:00:26,440 So we'll create a for loop where I start at zero and this loop is going to keep running so long as I 7 00:00:26,440 --> 00:00:27,820 is smaller than ten. 8 00:00:28,910 --> 00:00:33,200 And every time we run the loop, we need to increase EI by one. 9 00:00:34,050 --> 00:00:38,230 And every time this loop runs, we're going to print the following message. 10 00:00:38,250 --> 00:00:40,960 If Java was easy, they would call it Python. 11 00:00:40,980 --> 00:00:42,900 I totally agree with that. 12 00:00:43,230 --> 00:00:44,340 All right. 13 00:00:44,670 --> 00:00:48,150 And now we will put one breakpoint over here. 14 00:00:48,600 --> 00:00:49,680 And that should be it. 15 00:00:53,180 --> 00:00:58,760 So I start off equaling zero, which is smaller than ten, which means this loop is going to run. 16 00:00:59,330 --> 00:01:04,370 Now I equals one, which is still smaller than ten, so the loop is going to run again. 17 00:01:04,970 --> 00:01:07,730 Now I equals two again. 18 00:01:07,730 --> 00:01:12,920 This condition is going to remain true until I is not smaller than ten. 19 00:01:14,060 --> 00:01:14,330 All right. 20 00:01:14,330 --> 00:01:17,390 So at this point, our loop has run ten times. 21 00:01:17,390 --> 00:01:21,380 By the time we go back, I A-plus Plus is going to make this equal to ten. 22 00:01:21,380 --> 00:01:22,940 Ten is not smaller than ten. 23 00:01:22,940 --> 00:01:24,560 So our loop breaks. 24 00:01:26,240 --> 00:01:26,960 Beautiful. 25 00:01:29,410 --> 00:01:32,800 Tusk two is the number, each line starting from one. 26 00:01:32,950 --> 00:01:37,030 All right, so this means our start needs to be one. 27 00:01:37,030 --> 00:01:41,280 But if you do this, our for loop is only going to run nine times. 28 00:01:41,290 --> 00:01:47,140 So what we need to do is make this smaller than or equal to ten, and we need to print the number during 29 00:01:47,140 --> 00:01:48,310 each iteration. 30 00:01:49,840 --> 00:01:54,550 Och, supposed to put a dart here and we're good. 31 00:01:57,600 --> 00:01:58,530 All right. 32 00:01:58,980 --> 00:02:00,630 We're visualizing the runtime time. 33 00:02:01,050 --> 00:02:03,540 So this time I starts out one. 34 00:02:06,310 --> 00:02:07,510 We're off to a good start. 35 00:02:07,510 --> 00:02:13,150 One If Java was easy, they would call it Python and the last number needs to end at ten. 36 00:02:13,300 --> 00:02:14,800 Let us do just that. 37 00:02:17,010 --> 00:02:18,060 We'll keep going. 38 00:02:21,960 --> 00:02:25,450 So now I equals ten printing the last message. 39 00:02:25,470 --> 00:02:32,190 By the time we get back I A-plus plus updates I to become 1111 is not smaller than or equal to ten so 40 00:02:32,190 --> 00:02:33,300 the loop breaks. 41 00:02:35,050 --> 00:02:38,930 And this loop runs exactly ten times. 42 00:02:38,950 --> 00:02:41,320 I hope you enjoyed this breakpoint session.