Hello, friend.
Welcome back.
So now what we have done is we have made this program and whenever we run this program, it asks for
a user input and it draws the number of sites we enter.
OK, so we will continue developing this program further and we will learn a new concept while keeping
the programs simple.
OK, so the new concept that we will learn is about my blocks.
So this is a custom block.
You can develop your own block and you can write a program for your own block.
And once you write the program, you can start using that block.
OK, so we will learn how to do that.
So for that, first of all, we have to do is we have to create the block when we click here.
It is asking for a block name.
So I will write shapes.
Ships drop block, ships drying block.
OK, so if you are having any problem in writing this name or reading this name, then you should restart
scratch.
Sometimes scratch creates this problem.
We were using one variable that was angle of rotation, but we will need another variable that is number
of sites.
That we need to get from the user, so we will right here.
No offsets.
OK, so we're using this input and input, so this input will be given by user and the block name is
Shape's Drain Block.
So we have created this block.
Now let's click on OK, so this is the block that we have just created.
And you can see this block is not appearing here.
OK, now we created one variable number of sites so you can use this variability.
You can use it as many times as you want to.
This is a variable that we have created here.
Know what we will do is we will split the complete program into two parts.
So from where the program is running, it is running from here angle of rotation.
So we will make this block do this.
Programming note, it is asking for define shapes, drain block.
So this is the name of the block and the is defined shape, string block.
It means what this shapes ring block will do.
So this ship, string bloc will draw different ships, so that is the program we have to keep here.
OK.
Another thing that we will be doing is we will shift this angle of rotation, set angle of rotation
to zero, which we usually do with our variables will shift to here.
And we can just write everything here.
OK, and we can just keep this how many sides you want and just the complete program can be shifted
here.
So this is how we can make this block.
So we have made this block in this block.
The whole program is written and here we are just asking for user input.
Now, these two are different programs.
This is one program and this is another program.
Now, let's run the program.
If I click here and into six, you can see I have entered six, but the value of angle has not changed.
OK, it means this program has not executed at all.
Nothing has happened here.
So what shall we do know?
These are two different programs.
This is one program and this is another program.
So this program cannot run unless and until we give a command to run this program.
OK, so this is known as a function in text based programming, in any text programming, whether you
learn C, C++, Java or any other programming method.
This is known as a function, which is a standalone program in itself.
And to run this standalone program, one instruction needs to be parsed here in the main program, then
only this program can run.
So this is a separate program and this is a separate program.
But this is the main program and this separate program can only run whenever we pass an instruction
to run this program on this program.
So that instruction is shaped during block.
Now, this has become one instruction whenever we write this instruction here, it will give a signal
to this program, which is a separate program or which is a shoestring block.
You have to execute.
No.