1 00:00:00,810 --> 00:00:03,540 C plus plus support jumps. 2 00:00:03,540 --> 00:00:06,630 And in most cases there are better ways to branch code. 3 00:00:06,660 --> 00:00:10,680 However, for completeness, we will cover the mechanism here. 4 00:00:10,710 --> 00:00:18,000 There are two parts to a jump, a labeled statement to jump and the to go to statement. 5 00:00:18,030 --> 00:00:24,300 A label has the same naming rules as a variable and it's declared suffixed with a colon. 6 00:00:24,300 --> 00:00:27,070 And it must be before statement here. 7 00:00:27,090 --> 00:00:30,480 The Goto statement is called using the labels name here. 8 00:00:30,720 --> 00:00:34,530 Let's make it the another for loop here for integer. 9 00:00:36,330 --> 00:00:41,430 Or integer zero while is less than ten. 10 00:00:43,220 --> 00:00:50,250 Lower integer zero while is less than ten and increment by one. 11 00:00:50,270 --> 00:00:57,560 Here and std std see out or make it see out here. 12 00:00:57,590 --> 00:01:01,580 See out e here and inline here. 13 00:01:01,910 --> 00:01:11,030 And if e equals five then go to end here and. 14 00:01:11,910 --> 00:01:12,390 Here. 15 00:01:12,420 --> 00:01:14,880 Actually, we don't, uh, need. 16 00:01:15,270 --> 00:01:17,310 We have to declare the end here as well. 17 00:01:17,310 --> 00:01:20,820 If we make it go to here and here. 18 00:01:23,410 --> 00:01:26,200 Outside the loop here in the main function. 19 00:01:26,200 --> 00:01:27,130 And. 20 00:01:27,610 --> 00:01:28,990 And STD. 21 00:01:29,710 --> 00:01:30,160 STD. 22 00:01:34,090 --> 00:01:35,620 Arrested or out. 23 00:01:37,240 --> 00:01:38,500 And here. 24 00:01:43,160 --> 00:01:47,580 So the label must be in the same function as the calling go through here. 25 00:01:47,600 --> 00:01:51,020 So let's make it run. 26 00:01:51,020 --> 00:02:01,190 And as you can see here, if condition is executed and we made it with go to keyword and executed the 27 00:02:01,220 --> 00:02:02,060 end here. 28 00:02:02,060 --> 00:02:07,280 So the label must be in the same function as the calling go through here, as I said earlier. 29 00:02:07,280 --> 00:02:13,430 But the jumps are rarely used because they encourage you to write non structured code. 30 00:02:13,460 --> 00:02:19,730 However, if you have a routine with the loops or if statements, it might make more sense and more 31 00:02:19,730 --> 00:02:25,160 readable to use a goto to jump to clean up code here.