1 00:00:00,068 --> 00:00:02,735 (upbeat music) 2 00:00:05,250 --> 00:00:07,170 Frank: Hello, everyone. Welcome back. 3 00:00:07,170 --> 00:00:10,410 In this video, I'm gonna talk about stateful Lambdas 4 00:00:10,410 --> 00:00:13,290 and I'm gonna show you some examples in the IDE. 5 00:00:13,290 --> 00:00:17,130 I'm in the section 21 workspace, as you can see right here, 6 00:00:17,130 --> 00:00:19,890 and I'm in the stateful Lambdas project. 7 00:00:19,890 --> 00:00:22,230 So I've got 10 different test functions 8 00:00:22,230 --> 00:00:23,220 that I'm gonna show you. 9 00:00:23,220 --> 00:00:25,530 Each one does something just a little bit differently 10 00:00:25,530 --> 00:00:27,000 and the idea is to give you a flavor 11 00:00:27,000 --> 00:00:29,310 for what stateful Lambdas can do 12 00:00:29,310 --> 00:00:31,410 and different ways that they can do things. 13 00:00:31,410 --> 00:00:34,230 So let's go over this first test example. 14 00:00:34,230 --> 00:00:35,550 I've already gone ahead and built this 15 00:00:35,550 --> 00:00:37,770 and run it in all test cases over here running 16 00:00:37,770 --> 00:00:39,870 so I'm just gonna walk you right through them. 17 00:00:39,870 --> 00:00:42,450 I'm including iostream, vector, and algorithm 18 00:00:42,450 --> 00:00:43,980 which we'll use later. 19 00:00:43,980 --> 00:00:46,020 And let me just scroll up just a little bit here. 20 00:00:46,020 --> 00:00:47,820 All right, so notice right here 21 00:00:47,820 --> 00:00:50,310 that we have a variable called global_x 22 00:00:50,310 --> 00:00:52,860 and I've initialized it to 1,000. 23 00:00:52,860 --> 00:00:56,310 That variable is global to this file 24 00:00:56,310 --> 00:00:59,430 so it's accessible anywhere in this file. 25 00:00:59,430 --> 00:01:02,370 However, I can't capture that kind of variable, okay? 26 00:01:02,370 --> 00:01:04,080 We can't capture those kinds of variables. 27 00:01:04,080 --> 00:01:05,970 We can't capture global variables, for example. 28 00:01:05,970 --> 00:01:08,220 We can't capture static variables. 29 00:01:08,220 --> 00:01:10,170 So if you try to capture that variable 30 00:01:10,170 --> 00:01:11,820 in the capture list right here, 31 00:01:11,820 --> 00:01:13,680 and I'll talk about that in a minute, 32 00:01:13,680 --> 00:01:15,120 the compiler is gonna give you a warning 33 00:01:15,120 --> 00:01:18,360 about only automatic variables can be captured. 34 00:01:18,360 --> 00:01:20,610 And that's all about the reaching scope of the Lambda. 35 00:01:20,610 --> 00:01:22,170 That's what can the Lambda see. 36 00:01:22,170 --> 00:01:23,940 So let me clear this 37 00:01:23,940 --> 00:01:26,220 and let's go over this one step at a time. 38 00:01:26,220 --> 00:01:27,883 So remember that we've got that global_x out there 39 00:01:27,883 --> 00:01:29,760 and it's 1,000. 40 00:01:29,760 --> 00:01:31,650 Now inside this test function, 41 00:01:31,650 --> 00:01:33,750 I have a local variable called x, right? 42 00:01:33,750 --> 00:01:36,870 It's called local_x and it's set to 100. 43 00:01:36,870 --> 00:01:38,880 Now I've got my Lambda expression 44 00:01:38,880 --> 00:01:41,490 which I'm assigning to this variable l. 45 00:01:41,490 --> 00:01:43,770 And notice it's got a capture, right? 46 00:01:43,770 --> 00:01:46,530 Those square brackets, that's where we put all our captures. 47 00:01:46,530 --> 00:01:48,891 So this makes this guy a stateful lambda, 48 00:01:48,891 --> 00:01:49,724 not a stateless lambda. 49 00:01:50,700 --> 00:01:53,520 In this case, we're capturing local_x. 50 00:01:53,520 --> 00:01:55,260 That's that guy right there. 51 00:01:55,260 --> 00:01:57,900 Now, by default, we are capturing by value. 52 00:01:57,900 --> 00:01:59,730 That's the default capture mode. 53 00:01:59,730 --> 00:02:02,310 What that means is that this Lambda 54 00:02:02,310 --> 00:02:07,140 is going to have a copy of local_x in it, okay? 55 00:02:07,140 --> 00:02:09,586 So let's just called this guy local_x 56 00:02:10,620 --> 00:02:15,360 and it is going to be a copy of what it captured. 57 00:02:15,360 --> 00:02:16,980 So it's gonna have 100 in it. 58 00:02:16,980 --> 00:02:19,710 Let me write that really large so there's no confusion. 59 00:02:19,710 --> 00:02:20,970 This is a copy. 60 00:02:20,970 --> 00:02:23,460 In this case, I'm making a copy of that integer. 61 00:02:23,460 --> 00:02:26,610 If this variable here were to be an object, 62 00:02:26,610 --> 00:02:29,190 then we're gonna call a copy constructor to make a copy. 63 00:02:29,190 --> 00:02:30,600 So it's really important to understand 64 00:02:30,600 --> 00:02:31,850 that we're making a copy. 65 00:02:32,850 --> 00:02:35,700 Then we're just outputting the local_x's value 66 00:02:35,700 --> 00:02:36,900 and the global_x's value. 67 00:02:36,900 --> 00:02:39,630 So now when we call that Lambda, 68 00:02:39,630 --> 00:02:43,170 what's going to happen is this code right here will execute, 69 00:02:43,170 --> 00:02:45,090 the local_x will display. 70 00:02:45,090 --> 00:02:47,490 This local_x, that's the copy, 71 00:02:47,490 --> 00:02:48,323 and it's gotta display 100. 72 00:02:48,323 --> 00:02:50,790 And you can see right up here my Test1, 73 00:02:50,790 --> 00:02:52,170 it's gonna display 100 74 00:02:52,170 --> 00:02:53,850 and then we're gonna display global_x 75 00:02:53,850 --> 00:02:54,870 and it's just finding that 76 00:02:54,870 --> 00:02:57,030 just because of normal scope rules. 77 00:02:57,030 --> 00:02:58,980 It's gonna find global_x, it's a 1,000, 78 00:02:58,980 --> 00:03:00,990 and it's gonna display 1,000 right here. 79 00:03:00,990 --> 00:03:01,823 Pretty straightforward. 80 00:03:01,823 --> 00:03:06,750 Now, if we try to modify local_x inside the Lambda's body, 81 00:03:06,750 --> 00:03:08,100 we're not gonna be able to. 82 00:03:08,100 --> 00:03:11,040 So in order to do that, we need to use the mutable keyword. 83 00:03:11,040 --> 00:03:12,840 And I'm gonna do that in the next example. 84 00:03:12,840 --> 00:03:14,490 So let me scroll up just a little bit. 85 00:03:14,490 --> 00:03:16,380 I'm gonna scroll here to Test2. 86 00:03:16,380 --> 00:03:17,730 I'm gonna scroll up here as well. 87 00:03:17,730 --> 00:03:19,800 So right now, we're talking about Test2, 88 00:03:19,800 --> 00:03:22,290 which is that output right over here. 89 00:03:22,290 --> 00:03:24,030 Okay, so let's take a look at Test2. 90 00:03:24,030 --> 00:03:29,030 Test2, we have a local variable x, and here's our lambda. 91 00:03:29,340 --> 00:03:31,440 We're capturing that local variable x, 92 00:03:31,440 --> 00:03:34,060 so that means that this lambda has an x 93 00:03:34,920 --> 00:03:36,630 and it's a copy of this x, 94 00:03:36,630 --> 00:03:38,283 so I'm gonna put 100 in here. 95 00:03:39,210 --> 00:03:41,070 Okay, that's really important. 96 00:03:41,070 --> 00:03:43,500 Now, when we execute the body, 97 00:03:43,500 --> 00:03:45,292 notice we're changing that x, 98 00:03:45,292 --> 00:03:46,710 we're incrementing it by 100, 99 00:03:46,710 --> 00:03:49,590 it is allowed now because I'm using mutable. 100 00:03:49,590 --> 00:03:51,150 Because I have that mutable keyword, 101 00:03:51,150 --> 00:03:52,770 it's allowing me to do that. 102 00:03:52,770 --> 00:03:53,880 So what's gonna happen here 103 00:03:53,880 --> 00:03:56,640 is I'm going to increment the local value, 104 00:03:56,640 --> 00:03:59,880 not this guy, the local, the copy, 105 00:03:59,880 --> 00:04:01,710 I'm gonna increment it by 100. 106 00:04:01,710 --> 00:04:05,610 So this guy now becomes 200, and I'm gonna display that. 107 00:04:05,610 --> 00:04:09,870 So when I call the Lambda, this body executes, 108 00:04:09,870 --> 00:04:11,748 it just incremented that to 200 109 00:04:11,748 --> 00:04:15,213 and we're gonna display x which is 200 right there. 110 00:04:16,500 --> 00:04:19,200 Now when I leave, remember I just called that Lambda here, 111 00:04:19,200 --> 00:04:21,510 now I'm back and I'm gonna display x. 112 00:04:21,510 --> 00:04:23,220 Well, the only x that this statement 113 00:04:23,220 --> 00:04:25,350 has access to is this x, 114 00:04:25,350 --> 00:04:28,320 and that x has not been changed because we copied it. 115 00:04:28,320 --> 00:04:30,123 Remember, this was a copy here. 116 00:04:31,290 --> 00:04:32,580 That was a copy. 117 00:04:32,580 --> 00:04:34,230 So in this case, it hasn't changed, 118 00:04:34,230 --> 00:04:36,513 so what's gonna display is 100. 119 00:04:37,440 --> 00:04:40,050 Now, this is the piece that's really important to understand 120 00:04:40,050 --> 00:04:42,540 and a lot of students and a lot of people in general 121 00:04:42,540 --> 00:04:45,060 don't understand how this works with Lambdas, 122 00:04:45,060 --> 00:04:46,710 but it's really important to understand. 123 00:04:46,710 --> 00:04:47,700 Notice what happens here. 124 00:04:47,700 --> 00:04:50,970 I'm calling Lambda again, I'm calling that Lambda l again. 125 00:04:50,970 --> 00:04:54,360 So I'm gonna call this Lambda again. 126 00:04:54,360 --> 00:04:57,330 What happens is the body of the Lambda executes, 127 00:04:57,330 --> 00:04:59,160 we do not capture again. 128 00:04:59,160 --> 00:05:01,170 The capture only happened here 129 00:05:01,170 --> 00:05:03,270 when we initialize that variable l. 130 00:05:03,270 --> 00:05:05,670 So we do not capture the 100 again. 131 00:05:05,670 --> 00:05:09,240 That Lambda expression already has that local x 132 00:05:09,240 --> 00:05:11,400 and it's right here and it's 200. 133 00:05:11,400 --> 00:05:12,690 All right, so again, we're right here. 134 00:05:12,690 --> 00:05:13,890 I'm calling this Lambda. 135 00:05:13,890 --> 00:05:17,310 That's gonna increment this guy now to 300 136 00:05:17,310 --> 00:05:20,310 and it's gonna display 300 right there. 137 00:05:20,310 --> 00:05:22,470 Now when I come back here, I display x, 138 00:05:22,470 --> 00:05:25,650 which is this x that's local to this Test2 function 139 00:05:25,650 --> 00:05:27,120 and it's gonna display 100. 140 00:05:27,120 --> 00:05:28,380 Hopefully that makes sense. 141 00:05:28,380 --> 00:05:29,850 If it doesn't make sense, 142 00:05:29,850 --> 00:05:31,920 go back to the slides and look at the slides. 143 00:05:31,920 --> 00:05:32,910 And it's really important 144 00:05:32,910 --> 00:05:34,050 that you understand what's happening. 145 00:05:34,050 --> 00:05:36,240 Remember, that's the stateful Lambda. 146 00:05:36,240 --> 00:05:37,980 When we have that lambda, 147 00:05:37,980 --> 00:05:40,833 remember that class that got created. 148 00:05:41,700 --> 00:05:43,470 Remember we talked about that closure class 149 00:05:43,470 --> 00:05:44,490 that was created? 150 00:05:44,490 --> 00:05:49,490 It has a constructor and it has the function call operator. 151 00:05:50,790 --> 00:05:53,070 This would be the constructor. 152 00:05:53,070 --> 00:05:57,240 Right here, the constructor will be called. 153 00:05:57,240 --> 00:06:02,240 Right here, the operator function will be called. 154 00:06:02,700 --> 00:06:04,653 Right here, the operator, 155 00:06:05,610 --> 00:06:07,470 the function call operator will be called. 156 00:06:07,470 --> 00:06:09,270 That's really important to understand. 157 00:06:09,270 --> 00:06:11,100 The only time that we capture 158 00:06:11,100 --> 00:06:13,710 is when that constructor's executed 159 00:06:13,710 --> 00:06:15,330 and that's only gonna be executed once. 160 00:06:15,330 --> 00:06:17,730 Remember, we can only initialize an object once. 161 00:06:17,730 --> 00:06:20,910 And that's exactly what l is. It's an object. 162 00:06:20,910 --> 00:06:22,350 So again, take your time with that, 163 00:06:22,350 --> 00:06:23,190 wrap your head around it 164 00:06:23,190 --> 00:06:24,660 'cause it's really, really important to understand 165 00:06:24,660 --> 00:06:25,680 what's happening there. 166 00:06:25,680 --> 00:06:27,960 Okay, so let's take a look at Test3. 167 00:06:27,960 --> 00:06:29,820 Now what's happening with Test3 is 168 00:06:29,820 --> 00:06:32,580 we're capturing by reference. 169 00:06:32,580 --> 00:06:35,760 So again, I've got my x right here, it's 100. 170 00:06:35,760 --> 00:06:37,950 Now we're capturing that x by reference 171 00:06:37,950 --> 00:06:39,330 and that's the syntax right there. 172 00:06:39,330 --> 00:06:41,970 We're using that ampersand, the referencing operator. 173 00:06:41,970 --> 00:06:44,790 So what happens now is, and it's mutable as well, 174 00:06:44,790 --> 00:06:49,170 what we're gonna do now is that x is local 175 00:06:49,170 --> 00:06:50,520 and it's not really an x, right? 176 00:06:50,520 --> 00:06:51,660 We have a reference. 177 00:06:51,660 --> 00:06:53,490 That's really important to understand as well. 178 00:06:53,490 --> 00:06:54,840 So whenever we change x, 179 00:06:54,840 --> 00:06:57,840 we're actually changing the actual x right here. 180 00:06:57,840 --> 00:06:58,770 So what do we do here? 181 00:06:58,770 --> 00:07:01,620 The body increments x by 100 and we display x. 182 00:07:01,620 --> 00:07:03,690 So let's call it. 183 00:07:03,690 --> 00:07:05,100 What's gonna happen? 184 00:07:05,100 --> 00:07:06,480 It's already captured x, right? 185 00:07:06,480 --> 00:07:09,570 Its value is a reference to the actual. 186 00:07:09,570 --> 00:07:11,430 We're gonna increment it by 100. 187 00:07:11,430 --> 00:07:12,690 What we're gonna do is we're gonna increment 188 00:07:12,690 --> 00:07:14,010 not any local copy. 189 00:07:14,010 --> 00:07:14,880 There is none. 190 00:07:14,880 --> 00:07:17,640 We're gonna increment this guy by 100 191 00:07:17,640 --> 00:07:19,110 and we're gonna display it. 192 00:07:19,110 --> 00:07:21,540 So that's going to display 200 here 193 00:07:21,540 --> 00:07:23,910 and you can see it right up there. 194 00:07:23,910 --> 00:07:26,490 Now, when we return from the function call, 195 00:07:26,490 --> 00:07:28,773 we're going to display this x right here. 196 00:07:30,030 --> 00:07:33,150 It has been changed because we captured by reference. 197 00:07:33,150 --> 00:07:35,610 So that's also going to display 200. 198 00:07:35,610 --> 00:07:37,530 Okay, so that's three examples 199 00:07:37,530 --> 00:07:38,760 that are a little bit different from one another, 200 00:07:38,760 --> 00:07:40,170 but hopefully you'll see what's going on. 201 00:07:40,170 --> 00:07:41,760 All right, so now in this case, 202 00:07:41,760 --> 00:07:45,540 we're gonna use default capture by value 203 00:07:45,540 --> 00:07:47,460 and we're gonna do it mutable just to make it more fun 204 00:07:47,460 --> 00:07:48,780 so we can actually change something 205 00:07:48,780 --> 00:07:50,760 and you can really see what's happening. 206 00:07:50,760 --> 00:07:52,950 So here we're in Test4 207 00:07:52,950 --> 00:07:55,050 and we've got these three local variables 208 00:07:55,050 --> 00:07:59,730 to this Test4 function, x, y, and z, 100, 200, 300. 209 00:07:59,730 --> 00:08:01,740 Here's our Lambda variable 210 00:08:01,740 --> 00:08:05,830 and we are capturing everything by value. 211 00:08:05,830 --> 00:08:09,060 Okay, so that's the default capture by value. 212 00:08:09,060 --> 00:08:13,020 So we're capturing x, y, and z by value. 213 00:08:13,020 --> 00:08:17,130 What's gonna happen here is I'm gonna make a copy of x, 214 00:08:17,130 --> 00:08:21,750 I'm gonna make a copy of y, and I'm gonna make a copy of z. 215 00:08:21,750 --> 00:08:25,710 So x is 100, so I'm gonna make that copy, 216 00:08:25,710 --> 00:08:27,600 y is 200 217 00:08:27,600 --> 00:08:29,850 and z is 300. 218 00:08:29,850 --> 00:08:31,050 But now notice something, 219 00:08:31,050 --> 00:08:34,590 we are not using z in this code at all. 220 00:08:34,590 --> 00:08:36,390 So the compiler's not gonna capture it. 221 00:08:36,390 --> 00:08:38,850 Why capture something that you're not going to use? 222 00:08:38,850 --> 00:08:40,380 So this won't happen. 223 00:08:40,380 --> 00:08:42,299 It's not gonna waste its time doing that. 224 00:08:42,299 --> 00:08:44,430 So the only thing that's captured is x and y. 225 00:08:44,430 --> 00:08:47,310 And you're gonna get a warning in the output 226 00:08:47,310 --> 00:08:49,440 when you build this program saying 227 00:08:49,440 --> 00:08:52,350 that variable z was not captured since it's not being used. 228 00:08:52,350 --> 00:08:54,150 Some kind of unused variable warning. 229 00:08:54,150 --> 00:08:56,190 So again, by value, right? 230 00:08:56,190 --> 00:08:58,380 So again, we've made copies. 231 00:08:58,380 --> 00:09:00,960 Now I'm going to increment x by 100. 232 00:09:00,960 --> 00:09:03,840 So x is now 200. 233 00:09:03,840 --> 00:09:06,060 Remember this x here, not this x here, 234 00:09:06,060 --> 00:09:07,950 'cause we're capturing by value. 235 00:09:07,950 --> 00:09:11,310 y is incremented by 100. 236 00:09:11,310 --> 00:09:13,230 I'm sorry, that's 200 here. 237 00:09:13,230 --> 00:09:17,880 No, that's correct, y was 200, now y is 300, that's correct. 238 00:09:17,880 --> 00:09:20,100 And now I'm gonna output x and y, right? 239 00:09:20,100 --> 00:09:21,810 Now let's call the Lambda. 240 00:09:21,810 --> 00:09:23,700 This will execute, it gives us this, 241 00:09:23,700 --> 00:09:25,553 and what we're going to display is right here, 242 00:09:25,553 --> 00:09:29,400 200 and 300, these values. 243 00:09:29,400 --> 00:09:31,380 When I come back from the function call, 244 00:09:31,380 --> 00:09:33,120 I'm going to display x and y. 245 00:09:33,120 --> 00:09:36,060 I'm not gonna display this x and this y, 246 00:09:36,060 --> 00:09:37,830 not the ones in the Lambda. 247 00:09:37,830 --> 00:09:40,740 So that's going to display the 100 and the 200. 248 00:09:40,740 --> 00:09:42,990 Okay, so let's do a couple more 249 00:09:42,990 --> 00:09:44,910 and then I'll switch over to another video 250 00:09:44,910 --> 00:09:46,830 'cause this one's probably gonna get a little bit long. 251 00:09:46,830 --> 00:09:50,220 In this case, we are doing default capture by reference. 252 00:09:50,220 --> 00:09:53,580 That means we're capturing everything by reference. 253 00:09:53,580 --> 00:09:56,550 Those are my three variables here, x, y, and z. 254 00:09:56,550 --> 00:09:58,530 I'm capturing everything by reference, 255 00:09:58,530 --> 00:10:02,850 so it's a single ampersand sign in the capture list. 256 00:10:02,850 --> 00:10:04,200 So what does that mean? 257 00:10:04,200 --> 00:10:06,870 That means that I've got an x, a y, and a z 258 00:10:06,870 --> 00:10:10,020 that are references to the actuals, right? 259 00:10:10,020 --> 00:10:10,980 So that's what we've got. 260 00:10:10,980 --> 00:10:12,510 We're not making copies of these guys. 261 00:10:12,510 --> 00:10:13,863 We've got references. 262 00:10:14,700 --> 00:10:16,800 And we're gonna increment each by 100 263 00:10:16,800 --> 00:10:18,570 and we're gonna display them, right? 264 00:10:18,570 --> 00:10:19,800 So when I call this function, 265 00:10:19,800 --> 00:10:23,700 what's gonna happen is this guy will become 200, 266 00:10:23,700 --> 00:10:28,700 this guy will become 300 and z will become 400. 267 00:10:29,100 --> 00:10:32,070 This function will display them, and we're in Test5, 268 00:10:32,070 --> 00:10:36,510 so you can see right here, we're displaying 200, 300, 400. 269 00:10:36,510 --> 00:10:39,003 Now, when we come back from the function, 270 00:10:40,080 --> 00:10:42,060 we're gonna display these guys. 271 00:10:42,060 --> 00:10:44,130 Well, those are the same ones we just displayed, right? 272 00:10:44,130 --> 00:10:46,530 Because we actually changed the actuals 273 00:10:46,530 --> 00:10:47,700 through these references. 274 00:10:47,700 --> 00:10:49,770 Okay, so again, that should be pretty straightforward. 275 00:10:49,770 --> 00:10:50,940 Hopefully everything is starting 276 00:10:50,940 --> 00:10:52,500 to come together a little bit. 277 00:10:52,500 --> 00:10:54,060 Once you get past the syntax, 278 00:10:54,060 --> 00:10:55,800 I think it's pretty straightforward. 279 00:10:55,800 --> 00:10:57,060 Let's do one more. 280 00:10:57,060 --> 00:11:00,210 And in this case, it's Test6. 281 00:11:00,210 --> 00:11:01,800 Let me scroll up here again a little bit. 282 00:11:01,800 --> 00:11:04,290 Okay, so we're in Test6, we're right up here. 283 00:11:04,290 --> 00:11:06,900 And in Test6, we've got those three variables again, 284 00:11:06,900 --> 00:11:08,910 x, y, and z, and now what we're doing, 285 00:11:08,910 --> 00:11:12,690 we're capturing by value and we're capturing by reference. 286 00:11:12,690 --> 00:11:13,980 So that's the syntax here. 287 00:11:13,980 --> 00:11:18,000 It says capture everything by value except y, 288 00:11:18,000 --> 00:11:20,100 capture y by reference. 289 00:11:20,100 --> 00:11:22,620 Okay, so again, capture everything by value, 290 00:11:22,620 --> 00:11:25,110 but capture y by reference. 291 00:11:25,110 --> 00:11:27,270 And it's mutable, so we can change 292 00:11:27,270 --> 00:11:28,800 the values we're capturing. 293 00:11:28,800 --> 00:11:33,750 So now we've got our x here, we're capturing x by value, 294 00:11:33,750 --> 00:11:35,313 so I'm gonna copy the 100. 295 00:11:36,150 --> 00:11:38,340 We're capturing y by reference. 296 00:11:38,340 --> 00:11:41,430 So here's my y, it's a reference. 297 00:11:41,430 --> 00:11:44,490 And my z, I'm capturing by value, 298 00:11:44,490 --> 00:11:49,230 so my z is going to be 300 right here, which I've copied. 299 00:11:49,230 --> 00:11:50,063 And then what I'm doing 300 00:11:50,063 --> 00:11:51,900 is I'm just gonna add 100 to each one of them. 301 00:11:51,900 --> 00:11:54,240 So I'm gonna call this Lambda. 302 00:11:54,240 --> 00:11:57,450 What's gonna happen is I'm gonna increment x by 100. 303 00:11:57,450 --> 00:11:59,310 That's this guy. 304 00:11:59,310 --> 00:12:01,260 I'm going to increment y by 100. 305 00:12:01,260 --> 00:12:03,963 That's my reference, so this guy now becomes 300. 306 00:12:04,800 --> 00:12:06,840 And then I'm going to increment z by 100, 307 00:12:06,840 --> 00:12:08,730 so this becomes 400. 308 00:12:08,730 --> 00:12:10,320 Then I'm gonna display x, y, and z. 309 00:12:10,320 --> 00:12:13,530 Well, that's 200, 300, 400. 310 00:12:13,530 --> 00:12:15,280 And that's what we see right there. 311 00:12:16,200 --> 00:12:18,600 When we come back from the function call, 312 00:12:18,600 --> 00:12:20,550 I'm going to display x, y, and z. 313 00:12:20,550 --> 00:12:23,010 Now we're gonna display these guys right up here, 314 00:12:23,010 --> 00:12:27,300 x, y and z, so it's gonna display 100, 300, 300 315 00:12:27,300 --> 00:12:28,830 and that's what you get right there. 316 00:12:28,830 --> 00:12:30,300 Okay, so I'm gonna stop the video here 317 00:12:30,300 --> 00:12:33,360 and then in the next video, I'll start from Test7, 318 00:12:33,360 --> 00:12:34,500 and we'll start right from there. 319 00:12:34,500 --> 00:12:36,050 I'll see you in the next video.