We went over some simple functions last time but today was talk about giving functions arguments or
parameters.
I said that the parentheses in the function signature can hold variables that we can pass values into.
So let's see how we could do that.
So let's say we had a function call it value and give it a an argument in X or parameter index.
So it's really just like declaring a variable.
So X can be used in the print value function to do any calculations that print value needs to do.
And if you remember the scope lecture X is the PSK the scope of index is really just the the scope of
the print value function in general.
So you can only use X in the print value function.
So let's just say see each integer.
It's X and know that and let's call the Felty function.
And we just need to give it an integer.
So this B since x is also part of the signature of the function the caller must provide a value to pass
into it.
So that's what we're doing in in here.
So you see what happens.
So not surprisingly it just says the integer is five.
Now it doesn't we don't have to just give it literal values like 5 you could have like variables say
10 Zad is to 10 and say you said hey and print out 10 can also have say arithmetic operations so say
Zad plus 20.
It should print out 30 right because it'll actually do the math the evaluation of the addition here
and then pass to the print value function and then print out the result.
So it doesn't all have to be just one argument you could have multiple arguments.
So how to do that is we have a comma between all of our arguments.
You can have char c that floats while say and we have to update our function signature down here as
well in that definition.
See why
if we call this now we have to call it with all three of those values.
And say and or is here to say out
character is C an inch
float is
y.
And that's C all three values that we put into print value are being outputted.
So that's how you can have multiple parameters in a in a function.
So we'll be talking about crammer's in arguments bit more a bit later in a different section but we
don't have tools to talk about it quite yet.
So we need to actually go over those tools and we'll do that in a bit of a later section and I'll show
you some more interesting things they can do.
RAMmers So in the next lecture we're in talk about return about this.