CODING
Coding is writing instructions for a computer to perform a task. This
code has to be in a form that the computer can understand. This is
more formally known as computer programming.
Programming languages
There are many programming languages currently used by coders
around the world. Some are best in one situation, others in another.
• HTML is good for producing web pages.
• SQL is great at making databases do what you want.
• Python is brilliant for writing quick applications, running
programming experiments and for building larger applications,
including games
.Scratch: Beginners often start with simple programming
languages such as Scratch. Instead of typing out code, you build
scripts with ready-made blocks of code.
START/STOP
Costume STAGE
Codes Sounds
Sprite or Character
Our Scratch
environment
Stage is at upper right (where actors act and
information is displayed)
Sprite is another name for actor.
Instruction menus/panel at left (instructions for
the actors)
A script Is another name for program or method; a script tells the actor what to do.
Programming area in center; here is where we construct scripts for the sprites
TOOLBAR: A number of tools exist for your use. The arrow is the default selection and it
allows you to pick up and move sprites and blocks of code around. There are also options
for you to duplicate and delete items as well as grow and shrink your sprite
INPUT AND OUTPUT
Looks’ Blocks
These are the command blocks used to create
visual output.
The looks’ block are purple In Color “click on
the purple dot to see looks’ block”
>drag one onto the script area ,click on the
block and see what happens'. Now try the other
block “what are the differences”
Sensing Blocks
The light blue Dot on the codes
represents the sensing blocks
In the scratch the input command
are the sensing blocks, they are
light blue in color.
“Click on the light blue dot to see
the sensing blocks.”
Example
One light blue blocks says’ ask "What is your name? ” and
wait.
Drag this block in to the script area and join in to the other
blocks ‘Now you have a program with two command
Run the Program
When you ran the program ,the sprite
asks your name .There is a space on the
screen so you can type your answer,
>>>your answer is the input to the
program.
Start Event
To start this program you must click on the blocks. But
there are other ways to start a program, the yellow
blocks with the curved top are "Start Event”
Click on the yellow dot to see yellow “Event
blocks”.
Find the block that says ‘When this sprite is
clicked’ ,
Join the event to the top of the program, click on
the sprite and the program will run.
Turn Input into Output
Answer block
Load and run the program you made
in the last session
• The sprites asks your name
• The sprite says “Hello”
Now you will change the program so
that instead of saying “hello” the
sprite says your name.
When you ran the program you typed some input. The computer will
save the input that you typed, So that you can used that saved input later
in your program.
>Drag the answer block to the script area , put the answer block to the
“Say Block” it fits exactly. Now the sprite will say the answer.
>>>>run the program, you can type any input, the sprite will say your
words back to you.
Simple Maths
Operators
In our last lesson we used two blocks.
• The “answer block”: This block stores our input.
• The “join block": This block joins two words
together.
In our last lesson we joined the ‘answer’ block
and ‘hello’
The ‘join block’ is an example of an operator.
Operators are used to transform or change
values .
Operators turn input into output.
Operator are shown using green dot ,click on the
green dot to see the operator.
Anew Program
I. Start anew empty screen, on yours scratch.
II. Choose any backdrop and sprite of your choice.
III. Choose the right blocks and join/fit together to
make the program shown here.
IV. Run the program and see what it does, the program
is no yet complete.