>> SPEAKER 1: Let's refine my implementation of cough
a little bit more.
So that rather than just cough a single time, when using a cough block
you can actually specify how many times that sprite should cough.
So this time I'm going to click, make a block.
I'm again going to call it cough.
But this time I'm going to expand these options.
>> There, I can specify that this cough block should take a number as input.
By clicking this icon here.
By default to that input otherwise known as an argument, has a default
name of number 1.
But I'm going to simplify that to just n, as is our commonly named variable
for counting something.
Which in this is coughs.
>> Now, I'm going to go ahead and click OK.
And I have the beginnings again, of a defined puzzle piece.
Otherwise known as a function.
Now, this function is going to allow me to specify in code how many times
Scratch should cough.
So let's grab first that repeats block.
But rather than hard coat a number like 10 or three, as
we've done in the past.
>> Let's grab this variable n and specify that we should repeat a variable
number of times.
N, however many times the user has specified.
Now what do we want Scratch to repeat some number of times?
Well, I want Scratch to say cough for one second.
Then I'd like to give him a moment's break.
>> And now I need to actually call that function in my actual program by
telling Scratch to cough.
So I'm going to drag my newly made cough puzzle piece.
And now rather than use the default of 1, I'm going to go ahead and specify
three coughs.
So now what's about to happen when I click the green flag is my cough
puzzle piece is going to get executed.
>> That number 3 is going to be past in to the cough function so to speak.
And that's where the functions code is going to take things from there.
Repeating n times or three in this case, saying cough for a second,
waiting for a second, repeating, repeating, and that's it.
Let's click the green flag.
Cough, cough, cough, and there you it.