So how did you find that homework?
Well, I mean, I gave you the function answer, really, you didn't have to think much about that,
but.
Her function homework, I don't think it's that necessary to to come up with these because you type
it all the time when you're coding, you'll soon get into the swing of things.
The tricky bit was to actually get those three numbers and multiply an array and I'm going to show you
a basic way of doing it.
We're going to have a VA return and this is going to contain the array of numbers that we're going to
return.
Which is an array of type int.
And this at first is going to have no elements in it's just empty.
They were going to say for a in the array that we're passing in.
We're going to have return dot append.
A times three.
So that loop is going to go round and round, get each value, multiply it by three and shove it into
the new array, and then finally we're going to return the return array.
And that is literally it.
So now we can call multiply.
The array.
Which will be, I don't know, let's try three, four or five.
When we play that, we should get 15, 20, 25.
But I mean, nine, 12, 15, because times three, not five, OK, so there we have it on the right
hand side.
Now, again, I want you to notice this word multiply.
It's obvious what we're doing.
If I give you an array of integers and I say, multiply this, everyone knows what that means.
You don't need to write things like multiply this array of ints.
Now, why don't I need to know that?
Well.
This array of integers is information that's actually communicated here, and I'll prove that to you.
Because if we're typing, multiply.
Look what comes up at the bottom of this pop up panel, we have multiply array array, which returns
an array.
So every time we are typing something in Swift, we get the signature that tells us what that item is
doing and what it's doing it on and what it's going to give you back, if anything.
So multiply is a perfectly valid word.
Don't overdo the naming, but also don't underdo it.
Do it just right.