WEBVTT 00:04.290 --> 00:04.840 Welcome. 00:05.610 --> 00:11.520 Let's take a look at how the continuous statement works, like the brake statements continue, a statement 00:11.520 --> 00:14.100 also breaks the loop, but it won't end the loop. 00:14.310 --> 00:16.110 It only ends the current step. 00:16.110 --> 00:19.440 But the loop itself will continue from where it left off. 00:20.860 --> 00:25.950 And I also show you how to use the integrated debugger inside the whiskered. 00:26.500 --> 00:27.710 OK, let's get started. 00:30.450 --> 00:36.090 This is a previous court, it's an artificial version of an actual four statements which are designed 00:36.090 --> 00:37.700 for you to see how it works. 00:38.660 --> 00:46.220 Now, let's say that I want to add only even numbers, the ones that are divisible by two, I can use 00:46.220 --> 00:47.720 a continuous statement to do that. 00:47.750 --> 00:49.130 Let's take a look first. 00:49.140 --> 00:51.100 I'm going to type another if statement. 00:51.380 --> 00:53.210 You'll see why in a second. 00:53.660 --> 00:59.600 In this statement, I'll check for whether the airable is evil or not using the remainder operator. 00:59.810 --> 01:03.560 If it's divisible by two, then that shouldn't be in the remainder. 01:04.430 --> 01:08.950 So if there is a reminder, then it means that the number is an odd number, right? 01:09.800 --> 01:13.200 This is exactly where I need to call the continuous statements. 01:13.610 --> 01:20.360 So if the number is not an even number, I want the loop to stop now and continue for the next number. 01:20.510 --> 01:22.970 OK, let me type continue now. 01:25.010 --> 01:31.760 OK, what the statement does is that it skips the rest of the code after it and it goes back to the 01:31.760 --> 01:34.170 beginning of the for loop, and that's all about it. 01:34.610 --> 01:35.270 Let me show you. 01:37.070 --> 01:43.280 They say that the program is on the line, OK, if the airable isn't an even number. 01:44.390 --> 01:45.890 Then it's around the continue. 01:47.190 --> 01:51.300 And when it does that, it will go back to the beginning of the loop like this. 01:53.050 --> 01:56.770 And from there, it will run the next statement and so. 01:57.950 --> 02:03.230 By the way, can you see a problem in this code now, please post the video and think about it. 02:10.020 --> 02:14.990 All right, now, let me show you this program in South Dakota, Ed. I'll fix the error as well. 02:19.830 --> 02:20.910 It is the same program. 02:21.900 --> 02:25.170 Now, let me show you the problem by using the built in debugger. 02:27.170 --> 02:31.150 First, I'm going to put a break point here at the beginning of the follow. 02:32.500 --> 02:36.910 This breakpoint will allow the debugger to stop in here, you'll see. 02:38.280 --> 02:42.620 Now, let me open the debugging panel from the left and start debugging. 02:44.810 --> 02:49.880 By the way, if you have installed all the go tools, these debugger should work on your machine as 02:49.880 --> 02:50.130 well. 02:51.410 --> 02:58.370 Behind the scenes, these debugger uses a program called Dalle, if it doesn't work, uninstall your 02:58.370 --> 03:03.080 editor and reinstall it again with the go tools, as I showed you before now. 03:03.100 --> 03:04.610 Check out the variables on the left. 03:05.460 --> 03:07.250 It shows them in real time. 03:07.850 --> 03:08.530 Cool, right? 03:09.580 --> 03:13.390 Now, the airable is one and the sum is zero. 03:14.170 --> 03:15.940 OK, let's run this first statement. 03:17.660 --> 03:22.130 I'm going to step into the fourth statement by clicking on this -- button here. 03:23.360 --> 03:28.780 This click on the step into again to continue now it's on the second if, right? 03:29.750 --> 03:31.780 This is where the problem happens. 03:32.770 --> 03:34.150 Let's step into this. 03:36.080 --> 03:38.180 Now it hits the continuous statement. 03:39.530 --> 03:40.450 OK, let's continue. 03:42.460 --> 03:44.310 Now, let's check the wearables again. 03:45.700 --> 03:49.000 Here, the airable is still equal to one, right? 03:50.210 --> 03:55.450 Let me continue running this a few more times, as you can see, it's been stuck here. 03:56.180 --> 03:58.040 The variables never change. 04:01.030 --> 04:03.610 Now, let's get back and fix this, OK? 04:07.130 --> 04:12.800 The problem happens because this continuous statement here makes the loop endlessly continue without 04:12.800 --> 04:14.630 increasing the airable. 04:15.560 --> 04:18.500 I need to increase the airable here again like this. 04:19.670 --> 04:20.860 This will fix the problem. 04:22.340 --> 04:23.040 Michelle Reagan. 04:28.770 --> 04:31.780 Now the airable changes its tune up. 04:32.490 --> 04:33.350 OK, let's continue. 04:36.720 --> 04:41.850 As you can see, this time, it escaped the second if and now it's on these line. 04:43.010 --> 04:45.170 It's no longer a never ending loop. 04:46.690 --> 04:49.150 OK, let me remove this breakpoints from here to. 04:52.520 --> 04:55.300 OK, let's run this from the terminal now. 04:58.040 --> 05:02.330 As you can see, it adds only the even numbers and the result is 30. 05:03.590 --> 05:07.260 As you can see, you need to be careful with the continuous statements. 05:07.280 --> 05:10.880 It may never end, especially in infinite loops like this. 05:11.810 --> 05:15.740 As a bonus, we have learned how to debug your go kart as well. 05:18.090 --> 05:23.550 OK, congrats, you learned to to use Loop's, you know, right, the cell phone to see in the next 05:23.550 --> 05:24.250 picture of.