1
00:00:00,720 --> 00:00:04,710
So why not just do everything in Maine?

2
00:00:04,920 --> 00:00:06,840
Why even have a function?

3
00:00:06,840 --> 00:00:10,920
So to answer this question, we're going to look at a previous problem.

4
00:00:12,000 --> 00:00:16,280
This is something that I've kind of smashed together, but you must remember this.

5
00:00:16,290 --> 00:00:19,410
It was kind of the last thing we went over with a for loop.

6
00:00:20,010 --> 00:00:27,350
We had this problem that we solved where we calculated a whole number raised to a power right and explain.

7
00:00:29,460 --> 00:00:32,530
So this is all good, right?

8
00:00:32,550 --> 00:00:35,950
We did this program, it seemed to do what we wanted it to.

9
00:00:35,980 --> 00:00:37,970
It doesn't seem that bad to have this in Maine.

10
00:00:37,980 --> 00:00:39,270
It's not too big, right?

11
00:00:40,140 --> 00:00:41,370
But what have we changed things?

12
00:00:42,120 --> 00:00:45,270
So would I add some more stuff to it?

13
00:00:45,280 --> 00:00:47,010
So this is what we did before.

14
00:00:48,310 --> 00:00:48,670
Right.

15
00:00:49,060 --> 00:00:54,610
This what the program had before, but now we say our program wants to do it over again with some hardcoded

16
00:00:54,610 --> 00:00:55,240
values.

17
00:00:55,630 --> 00:00:58,540
You notice when we make another integer here called three.

18
00:01:00,020 --> 00:01:01,010
What do we put in it?

19
00:01:01,280 --> 00:01:08,750
Well, we end up using the result from this previous calculation and we add it to the value three.

20
00:01:10,280 --> 00:01:13,120
So that result gets saved in i3.

21
00:01:13,490 --> 00:01:20,300
We also then make an AI for which will be like another exponent, so this i3 will kind of be like a

22
00:01:20,300 --> 00:01:21,020
new hole.

23
00:01:21,020 --> 00:01:24,710
No i4 will be like a new exponent.

24
00:01:26,630 --> 00:01:32,240
And we kind of do a similar thing, but what we do is three plus whatever I two currently has at this

25
00:01:32,240 --> 00:01:37,520
point in time, which will be whatever the user entered up here for it.

26
00:01:37,910 --> 00:01:42,560
We're still doing a procedural program where we kind of go top to bottom like this.

27
00:01:42,560 --> 00:01:50,870
So I too already has this value that came from the user result has whatever was calculated here that

28
00:01:50,870 --> 00:01:54,650
we printed out, and we add that to the value three.

29
00:01:54,650 --> 00:01:56,180
So add three plus result.

30
00:01:56,900 --> 00:02:01,340
Put it in here and take three plus I to put that answer in here.

31
00:02:01,820 --> 00:02:06,500
Now we have a new hole number and a new exponent.

32
00:02:07,670 --> 00:02:12,940
We do the same thing with the result by resetting it to one right result has been changed.

33
00:02:12,960 --> 00:02:18,740
You know, by doing all this math and here we want to reset it to one just like Line 13 so we can start

34
00:02:18,740 --> 00:02:20,360
this process all over again.

35
00:02:21,170 --> 00:02:27,200
So we do that and then we start the process all over again, except rather than doing eyes less than

36
00:02:27,200 --> 00:02:27,980
I do.

37
00:02:29,140 --> 00:02:32,440
Also want to point out that, you know, my naming was a little bad.

38
00:02:33,280 --> 00:02:36,010
These are integers that the user entered into.

39
00:02:36,010 --> 00:02:37,660
I was for iteration, right?

40
00:02:37,720 --> 00:02:39,160
I could have used another variable.

41
00:02:39,160 --> 00:02:40,500
I kind of told that to you last time.

42
00:02:40,510 --> 00:02:41,290
You don't have to use.

43
00:02:41,560 --> 00:02:42,340
We call it whatever.

44
00:02:42,340 --> 00:02:45,850
But just so you know that there's a separation in your mind.

45
00:02:45,850 --> 00:02:50,770
It's not isFor iteration, the eye one eye to eye three or four.

46
00:02:50,810 --> 00:02:54,190
Those are the integers that we're considering for the power thing.

47
00:02:55,190 --> 00:02:56,600
So we do it again, right?

48
00:02:56,840 --> 00:02:58,310
But with our new values.

49
00:02:59,360 --> 00:03:06,770
We're saying that while go as long as I've listened, I for restart is zero to eight plus plus do resort

50
00:03:06,770 --> 00:03:09,800
times equals three to get a new power right?

51
00:03:11,880 --> 00:03:18,210
What if we just kept doing this over and over again, though, what if I did the same thing again like

52
00:03:18,210 --> 00:03:22,350
this, this whole chunk, just like we repeated it here?

53
00:03:23,220 --> 00:03:24,900
What if I repeated it again?

54
00:03:25,140 --> 00:03:28,290
And then what if I repeated it again and again and again and again?

55
00:03:28,530 --> 00:03:34,230
It's kind of annoying, actually really annoying that I have to keep rewriting this for loop, right?

56
00:03:35,130 --> 00:03:36,780
I got to rewrite all this like.

57
00:03:38,160 --> 00:03:41,490
Code here, and it's just getting like a little irritating, so.

58
00:03:43,350 --> 00:03:51,450
What if we instead make a new function that does this calculation for us?

59
00:03:52,290 --> 00:04:00,990
It actually does the work to figure out the answer of raising one number to another.

60
00:04:01,210 --> 00:04:02,330
No power.

61
00:04:03,090 --> 00:04:05,700
It does the Ecsponent calculation for us.

62
00:04:06,000 --> 00:04:07,200
It does this for a loop.

63
00:04:07,650 --> 00:04:10,940
All this code is in there and then we can do it as many times as we want.

64
00:04:10,950 --> 00:04:13,520
We can call it from wherever we want in our program.

65
00:04:14,480 --> 00:04:15,930
But it will handle the work for us.

66
00:04:15,950 --> 00:04:20,300
We don't have to keep rewriting stuff, we can just rely on the function to do its job right.

67
00:04:20,330 --> 00:04:26,030
We'll just say, Hey, function, your job is to calculate a power like an exponent.

68
00:04:26,040 --> 00:04:30,380
I'm going to give you one hole number and one exponent and you're going to do the work and you're going

69
00:04:30,380 --> 00:04:33,950
to give me back the answer and then I can print that answer out to the user.

70
00:04:34,730 --> 00:04:36,590
So let's go ahead and do that.

71
00:04:36,650 --> 00:04:37,070
All right.

72
00:04:39,470 --> 00:04:41,270
I am actually going to go here.

73
00:04:41,540 --> 00:04:45,940
I have this in the Visual Studio ED.

74
00:04:47,330 --> 00:04:50,810
And what I'm going to do, I think I left my.

75
00:04:52,630 --> 00:04:54,460
Yep, I have my console down here still.

76
00:04:55,900 --> 00:04:58,780
So what I'm going to do is I'm going to make a function for this.

77
00:05:01,660 --> 00:05:10,330
So what I will do is I will say and and sorry, it's still a little hard for me to type a slight wrist

78
00:05:10,340 --> 00:05:14,440
injury, so it's going to be a little slow and I'm just going to call this

79
00:05:17,350 --> 00:05:18,040
power.

80
00:05:19,720 --> 00:05:24,340
Or I'll just say, what about Kalik power or something like that?

81
00:05:25,240 --> 00:05:28,900
I'm going to need to give it a whole number parameter, right?

82
00:05:28,900 --> 00:05:30,760
We're going to pass it some data, right?

83
00:05:30,760 --> 00:05:38,610
We're going to like send it up some data for to do the calculation with two things actually right.

84
00:05:38,620 --> 00:05:40,870
We need a whole number and we need an exponent.

85
00:05:40,870 --> 00:05:45,770
So I'm actually going to say type integer, right, because it's going to be an integer.

86
00:05:45,790 --> 00:05:50,020
We noticed that we used an integer for the whole number and an integer for the exponent.

87
00:05:50,500 --> 00:05:58,690
So I'm going to call this and whole and and I'm just going to say exp instead of exponent.

88
00:06:01,360 --> 00:06:05,650
So then I put some curly braces press enter, make some room here.

89
00:06:06,670 --> 00:06:11,800
All I'm going to do is copy paste this right and I'm going to change some things.

90
00:06:12,490 --> 00:06:19,810
So what I will do is I will copy paste this when I control.

91
00:06:19,810 --> 00:06:20,320
See?

92
00:06:21,940 --> 00:06:24,700
I'm going to go up here, and I'm sorry.

93
00:06:25,990 --> 00:06:31,420
So Resort is not known because it hasn't been defined here.

94
00:06:31,870 --> 00:06:38,170
I'm going to go ahead and delete it, and instead I'm going to define it in this function.

95
00:06:38,650 --> 00:06:41,080
I'm going to say end result equals one now.

96
00:06:41,590 --> 00:06:49,390
The function knows what result is before we defined our function in Maine and we didn't pass it.

97
00:06:50,320 --> 00:06:56,620
To the function, right, the function doesn't know about any data unless you pass it to it, right?

98
00:06:57,490 --> 00:07:01,900
It can't do anything with that result unless it makes its own data.

99
00:07:02,560 --> 00:07:08,530
Here, we're clearly defining a new variable inside the body of this function.

100
00:07:09,850 --> 00:07:11,410
This is an important concept.

101
00:07:11,770 --> 00:07:17,020
It's something called scope, just like inside of the air for inside of the for.

102
00:07:17,620 --> 00:07:24,850
If you're inside the body of some type of function or control control structure, you must make sure

103
00:07:24,850 --> 00:07:26,560
that the things that you're using.

104
00:07:27,640 --> 00:07:30,880
Are in the correct scope for you to be able to use them, right?

105
00:07:31,810 --> 00:07:38,650
Certain things inside curly braces may not be known by stuff that's outside of the curly basis.

106
00:07:39,310 --> 00:07:46,300
Here we're making sure that we have made a new function, a new variable inside of the curly braces

107
00:07:46,330 --> 00:07:47,020
of our function.

108
00:07:47,020 --> 00:07:49,180
So it's in the body that way.

109
00:07:49,180 --> 00:07:50,320
The function knows about it.

110
00:07:51,130 --> 00:07:55,920
We're not going to care about it being in Maine anymore because calc power does the work now.

111
00:07:55,960 --> 00:07:58,390
Maine doesn't need to calculate aerosol, right?

112
00:07:58,900 --> 00:08:02,530
Maine is just going to receive the answer passed back to it.

113
00:08:03,280 --> 00:08:10,180
All Maine is going to do is get the input data and then it's going to send it to scout power, how power

114
00:08:10,180 --> 00:08:12,190
will do the result and pass the answer back.

115
00:08:13,880 --> 00:08:16,380
Of course, so now we say Entwistle equals one.

116
00:08:17,690 --> 00:08:23,120
But what we're going to do is actually use our data.

117
00:08:24,310 --> 00:08:27,040
And these variables, rather than use, I want an eye to.

118
00:08:28,330 --> 00:08:29,350
I won.

119
00:08:30,450 --> 00:08:31,610
Was the whole right?

120
00:08:31,890 --> 00:08:38,010
Too is the exponent, so what we're going to do is just rename these right because we have a hole right

121
00:08:38,010 --> 00:08:38,380
here.

122
00:08:38,400 --> 00:08:39,750
I want is the whole number.

123
00:08:39,750 --> 00:08:42,120
So instead we'll call this hole.

124
00:08:43,270 --> 00:08:48,850
I, too, is the expert on it, so we will call this XP because that's what's right here.

125
00:08:51,250 --> 00:08:58,130
Mane knows about the hole in the exponent, but only it knows it in the context of i1 and I, right?

126
00:08:59,750 --> 00:09:05,630
So what we can do now is we can delete this because our calc power function is doing this work now.

127
00:09:06,470 --> 00:09:07,820
Let's let it do that work.

128
00:09:10,870 --> 00:09:14,240
So now we're go we're actually doing the calculation here.

129
00:09:14,260 --> 00:09:18,710
What we will do then is pass back the answer right in the results.

130
00:09:18,710 --> 00:09:23,170
So what we will say is return result.

131
00:09:26,640 --> 00:09:33,060
So after resort has the proper answer, which is once the loop is done running, think back to your

132
00:09:33,060 --> 00:09:34,590
for loop program, right?

133
00:09:35,660 --> 00:09:40,760
Result kept doing multiplication over and over again until it had the correct answer.

134
00:09:41,300 --> 00:09:48,500
Now that it has the correct answer on online 10, we can just return it and that is what's getting passed

135
00:09:48,500 --> 00:09:49,790
back to our call.

136
00:09:50,150 --> 00:09:53,000
We don't have a call yet, though, so let's go ahead and make that call.

137
00:09:54,320 --> 00:10:02,670
So what we will say is we will say and answer equals calc power.

138
00:10:02,690 --> 00:10:06,230
I see that right here in my editor, so I'm going to go ahead and press tab.

139
00:10:08,240 --> 00:10:11,750
Then I need to put the parentheses and here come the arguments, right?

140
00:10:12,710 --> 00:10:17,300
Let me see if you can guess what the arguments are going to be.

141
00:10:17,810 --> 00:10:19,190
What am I going to put in here?

142
00:10:19,370 --> 00:10:20,450
Separated by a comma?

143
00:10:22,900 --> 00:10:25,240
So take a moment to think or pause the video.

144
00:10:26,620 --> 00:10:34,660
What I'm going to do is I want and I to write because main reads the data from the user input into I

145
00:10:34,660 --> 00:10:40,060
one and does the same thing, reads the exponent into it too.

146
00:10:40,420 --> 00:10:42,310
So let's do that.

147
00:10:42,730 --> 00:10:48,400
We're going to put AI one and then a comma, and I'm going to put a space you don't have to, but a

148
00:10:48,400 --> 00:10:49,450
space if you don't want.

149
00:10:49,450 --> 00:10:50,530
But I'm going to say I too.

150
00:10:51,520 --> 00:10:53,860
And this is what gets passed up there.

151
00:10:55,040 --> 00:11:02,420
This whole is the whole no, and it gets passed up to this position here, where it says whole I to

152
00:11:02,420 --> 00:11:06,140
holds the exponent it gives passed up here to the exponent.

153
00:11:08,510 --> 00:11:11,090
So now we have our answer here, right?

154
00:11:11,100 --> 00:11:15,680
So once it does the calculation, it passes the answer back to here.

155
00:11:16,400 --> 00:11:22,730
And then we save that value with the assignment operator into this new variable called answer.

156
00:11:23,840 --> 00:11:28,370
Instead of doing result here, we will print out answer.

157
00:11:32,380 --> 00:11:35,470
Then down here, we can replace all this stuff to.

158
00:11:37,010 --> 00:11:42,680
So instead of I want an interview in Maine, we're going to use an eye 394 as our arguments.

159
00:11:43,370 --> 00:11:47,630
But what we can do is delete this stuff just like we deleted it up here.

160
00:11:47,840 --> 00:11:50,360
So I'm deleting that because calc power.

161
00:11:50,360 --> 00:11:51,470
Does that work now?

162
00:11:52,250 --> 00:11:53,120
Press delete.

163
00:11:54,230 --> 00:12:01,070
What we're going to do is we can reuse this, but we're going to get a new value in it, so I'm going

164
00:12:01,070 --> 00:12:13,250
to say answer is now equal to count power and I'm not going to put I want an to this time, I want to

165
00:12:13,250 --> 00:12:13,610
send it.

166
00:12:13,610 --> 00:12:22,640
I three and I four, so I say a three comma I four I three is the whole no, I four is the exponent,

167
00:12:23,210 --> 00:12:27,470
so I three gets passed up to here.

168
00:12:28,900 --> 00:12:36,760
I four gets passed up to here, and we're doing we're having it do this same task, but with different

169
00:12:36,760 --> 00:12:38,560
data now, right?

170
00:12:39,280 --> 00:12:42,850
And we need to find our answer variable up here.

171
00:12:43,360 --> 00:12:46,950
We don't need to make another answer variable.

172
00:12:46,960 --> 00:12:49,990
We can just reuse it right here.

173
00:12:50,000 --> 00:12:57,840
What's happening is that when we get our new answer from the power, it gets overwritten into here.

174
00:12:57,850 --> 00:13:03,260
So answer whatever is an answer, which is whatever came from here, right?

175
00:13:03,280 --> 00:13:04,790
That's the last thing we did.

176
00:13:04,810 --> 00:13:13,060
Top to bottom the last time we did something with answers when this got saved into answer here what

177
00:13:13,060 --> 00:13:16,990
we are doing is kind of taking.

178
00:13:17,910 --> 00:13:25,110
A new value from Cat Power overriding what was in answer and putting the new value in there.

179
00:13:25,110 --> 00:13:27,390
So it's kind of like a race or whatever is in answer.

180
00:13:27,420 --> 00:13:28,230
Clear it out.

181
00:13:28,410 --> 00:13:30,660
Put this new thing in answer.

182
00:13:31,380 --> 00:13:38,870
Now what we can do is have the same kind of see outline, but instead of I want an I to, we have three

183
00:13:38,870 --> 00:13:41,820
and four and we still put an answer here.

184
00:13:43,880 --> 00:13:45,410
So we print out the answer.

185
00:13:45,590 --> 00:13:48,860
We do it all over again with these new values.

186
00:13:49,730 --> 00:13:51,440
But it looks a lot cleaner, right?

187
00:13:51,470 --> 00:14:01,160
We just kind of outsourced our work to this function and we said, Hey, how power handle some stuff

188
00:14:01,160 --> 00:14:01,420
for us.

189
00:14:01,430 --> 00:14:02,640
Can you do this task?

190
00:14:02,660 --> 00:14:06,740
I want you to be able to calculate the power and then just give it back to me.

191
00:14:06,770 --> 00:14:09,230
Then I can print it out to the user in the console.

192
00:14:10,830 --> 00:14:14,650
And it says, sure, let me give you that answer and say, Oh, thanks for the answer.

193
00:14:14,740 --> 00:14:15,660
That's what Maine says.

194
00:14:16,260 --> 00:14:21,750
So here's some data I'm going to pass you some data calc powers like, Oh, cool, let me take this

195
00:14:21,750 --> 00:14:22,230
data.

196
00:14:22,860 --> 00:14:24,140
Let me do some calculations.

197
00:14:24,150 --> 00:14:27,360
Let me pass you back a single integer as an answer.

198
00:14:28,290 --> 00:14:30,170
Maine says, Hey, I got it right here.

199
00:14:30,180 --> 00:14:31,530
This is where I caught the data.

200
00:14:31,530 --> 00:14:32,850
You just gave me the answer.

201
00:14:32,910 --> 00:14:36,920
Let me save that in a new variable that I made called the answer on this line.

202
00:14:36,930 --> 00:14:43,740
It says, OK, I'm ready to print out some stuff to the user and then print out that answer I got in

203
00:14:43,770 --> 00:14:45,030
Maine says, Hey, you know what?

204
00:14:45,030 --> 00:14:50,760
I'm going to do it again, so let me make some new hole and exponent values on my own.

205
00:14:51,810 --> 00:14:57,300
Rather than getting it from the user, then it says, Hey, cat power, can you do some work for me

206
00:14:57,300 --> 00:14:57,720
again?

207
00:14:58,380 --> 00:15:02,360
Let me pass you some more data and cow power says, OK, great, pass me the data.

208
00:15:02,370 --> 00:15:03,780
I'm going to do the calculation.

209
00:15:03,780 --> 00:15:04,710
I'm going to pass you back.

210
00:15:04,710 --> 00:15:10,050
Another answer and Maine says, Hey, thanks, I got your answer right here in the highlighted section.

211
00:15:10,860 --> 00:15:14,970
I saved that answer into answer again.

212
00:15:14,980 --> 00:15:18,310
What I did was I overrode it, and I put it in answer.

213
00:15:18,960 --> 00:15:25,140
Now I can print out this new value that you passed me, and I do that with the C outline.

214
00:15:25,140 --> 00:15:30,240
I say I three and I four this time and I print out the new answer I just received from Cat Power.

215
00:15:32,310 --> 00:15:39,270
Hopefully, that was enough of an explanation for you to understand that I'm going to save this, so

216
00:15:39,270 --> 00:15:40,350
I went ahead and saved it.

217
00:15:40,350 --> 00:15:42,720
Right now, I actually you can do this to you and say right here.

218
00:15:45,150 --> 00:15:51,090
Let's go ahead and recompile this, I have a command right here to compile it.

219
00:15:52,050 --> 00:15:54,800
And this is actually function practice to.

220
00:15:55,170 --> 00:15:57,840
I just pressed up on that.

221
00:15:59,670 --> 00:16:09,840
Let me do this f l practice uh to.

222
00:16:15,350 --> 00:16:18,530
Our source told us that it helped to see.

223
00:16:21,400 --> 00:16:22,450
Oh, yeah.

224
00:16:22,600 --> 00:16:23,740
We have this problem.

225
00:16:24,670 --> 00:16:30,070
So on line 24, I have a result here, but it's no longer called result.

226
00:16:30,670 --> 00:16:33,540
It's called answer, so I have to change that.

227
00:16:33,580 --> 00:16:34,390
That was an error.

228
00:16:36,070 --> 00:16:40,720
So the thing that it complained about here was I had the weird result here.

229
00:16:40,720 --> 00:16:45,070
And so it said OK on line 24 starting and character 18.

230
00:16:45,370 --> 00:16:48,150
It said result was not declared in this scope.

231
00:16:48,160 --> 00:16:49,720
Remember, we talked about scope.

232
00:16:50,110 --> 00:16:54,340
So inside the scope of main, which is inside the curly braces.

233
00:16:56,720 --> 00:17:05,150
The compiler said, Hey, you're trying to add result to three, yet I've never seen the word result

234
00:17:05,150 --> 00:17:08,780
before, and that's because since we're doing top to bottom.

235
00:17:09,870 --> 00:17:11,290
There was no result, right?

236
00:17:11,310 --> 00:17:16,800
How can C++ know what the variable result is when we haven't even made it?

237
00:17:17,310 --> 00:17:19,230
What I did was I changed it to answer.

238
00:17:19,650 --> 00:17:25,460
And so when it said result right here in this zone, it was saying, OK, I don't know what that is.

239
00:17:25,470 --> 00:17:29,640
I can't compile this because you haven't told me what the word result means.

240
00:17:29,640 --> 00:17:32,970
You haven't told me what the variable holds or anything.

241
00:17:32,980 --> 00:17:33,900
You haven't defined it.

242
00:17:34,620 --> 00:17:35,910
I actually meant to put answers.

243
00:17:35,910 --> 00:17:37,260
So now I changed it to answer.

244
00:17:37,290 --> 00:17:38,890
Let's go ahead and recompile it.

245
00:17:40,110 --> 00:17:42,060
In fact, what I have to do first is save it.

246
00:17:42,600 --> 00:17:44,130
So let me save it less.

247
00:17:44,130 --> 00:17:46,350
Recompile it now.

248
00:17:46,350 --> 00:17:48,300
It's OK, I'm going to have to clear.

249
00:17:51,030 --> 00:17:53,220
And now what we can do is we can run this.

250
00:17:53,220 --> 00:17:57,660
So f l to um, was it no fail?

251
00:18:00,300 --> 00:18:03,840
What did I call that NFL PR too?

252
00:18:05,770 --> 00:18:12,870
So either way, I felt help are to run that.

253
00:18:13,650 --> 00:18:15,110
Let's get some numbers.

254
00:18:15,120 --> 00:18:18,660
I'm going to just say two to the third power.

255
00:18:20,250 --> 00:18:23,070
And then what it's going to do is it should print.

256
00:18:25,400 --> 00:18:30,830
This first two to the third power than what it's going to do is it's going, let's just predict this,

257
00:18:30,830 --> 00:18:31,070
right?

258
00:18:31,070 --> 00:18:31,550
That's what I'm would do.

259
00:18:31,580 --> 00:18:33,650
Let's see if we can predict what the answer is going to be.

260
00:18:34,730 --> 00:18:36,650
So we have to turn the third power.

261
00:18:36,650 --> 00:18:40,320
So what it will do is call cow power first with two and three.

262
00:18:40,850 --> 00:18:43,310
It should return the value eight, and it should say.

263
00:18:44,260 --> 00:18:50,260
To it, this is the carat symbol, two carat three is equal to eight.

264
00:18:50,740 --> 00:18:52,630
It'll do an inline go to a new line.

265
00:18:53,800 --> 00:18:59,350
It'll then say, I'm going to make a variable, I'm going to do three plus eight because eight was the

266
00:18:59,350 --> 00:19:00,100
answer, right?

267
00:19:00,460 --> 00:19:02,080
So it's eight, nine, 10, 11.

268
00:19:02,380 --> 00:19:04,870
It'll say, All right now, I three has 11.

269
00:19:05,590 --> 00:19:09,880
Then I'll say my four is three plus eye to eye.

270
00:19:09,880 --> 00:19:11,460
Two is going to be this value three.

271
00:19:11,470 --> 00:19:12,850
So three plus three is six.

272
00:19:13,420 --> 00:19:18,130
It's now going to calculate 11 to the six power.

273
00:19:18,640 --> 00:19:19,910
Honestly, I don't know what that is.

274
00:19:19,930 --> 00:19:23,160
Off the top of my head, but that's what it will print out.

275
00:19:23,170 --> 00:19:29,230
It'll say 11 to the sixth power is going to be whatever that answer is.

276
00:19:29,620 --> 00:19:32,050
So I when I press enter, that's what we really should see.

277
00:19:33,980 --> 00:19:34,760
And there we go.

278
00:19:35,060 --> 00:19:35,870
It's a big number.

279
00:19:37,100 --> 00:19:38,240
Hopefully, that is correct.

280
00:19:38,570 --> 00:19:40,430
You can double check that with a calculator.

281
00:19:41,920 --> 00:19:44,790
In fact, I think we could do that here.

282
00:19:48,010 --> 00:19:57,550
So I will just say 11 x to the Y six equals, and that looks like the same number right there, right?

283
00:19:57,970 --> 00:20:00,610
So one, seven seven one.

284
00:20:01,650 --> 00:20:05,580
Five, six, one, so that looks good, good to me.

285
00:20:06,690 --> 00:20:08,430
So that is pretty cool, right?

286
00:20:08,460 --> 00:20:16,260
We went ahead and outsourced all that work to our calc power function, so you can probably imagine

287
00:20:17,100 --> 00:20:23,000
just how much you could do now by having functions, how nice your program could be.

288
00:20:23,010 --> 00:20:26,160
Imagine having many, many functions that do many things.

289
00:20:26,430 --> 00:20:33,480
We're about to be able to write very large programs that do a lot of complex stuff, and these functions

290
00:20:33,720 --> 00:20:35,400
are going to help us a ton.

291
00:20:36,240 --> 00:20:38,700
This is probably a lot for you to absorb.

292
00:20:39,150 --> 00:20:44,490
I'm going to have more function videos, and in those function videos, we're going to look more into

293
00:20:44,490 --> 00:20:46,860
depth about what's going on with functions.

294
00:20:46,860 --> 00:20:50,070
And in fact, we are going to use more functions, not just one.

295
00:20:50,490 --> 00:20:52,020
So you can get more practice.

296
00:20:52,440 --> 00:20:57,990
And once I explained some more things using multiple functions, we will go over some problems just

297
00:20:57,990 --> 00:21:03,630
like we did with loops, so you will get a chance to exercise your newly learned skills.

298
00:21:04,800 --> 00:21:05,190
All right.

299
00:21:05,190 --> 00:21:10,350
So with that, I think that's enough that I've stuffed into your heads in this lecture about functions.

300
00:21:11,310 --> 00:21:16,890
Rewatch the video if necessary, I will be doing more function stuff.

301
00:21:17,040 --> 00:21:22,350
Don't worry if you're confused or nervous or feel like this is too much.

302
00:21:22,590 --> 00:21:26,130
We will practice so you can better understand and absorb it.

303
00:21:26,880 --> 00:21:29,190
With that, I will see you in the next lectures.
