Lesson 3 Scratch
Lesson 3 Scratch
Introduction to Scratch
– a Graphical Programming Tool
1
Pre Knowledge
Created a variable
2
Exploring data types
2. List – This is a data structure that can hold more than one
value using the same name. This will be discussed at a
later stage.
3
Variable
It is not necessary to declare what data type will be used before
running the program. Scratch will automatically determine the
data type of variable while the program is running.
Numbers String Boolean
4
Naming conventions of
variables
Scratch does not have strict rules with the naming of variables, but other
programming languages do. When you create a variable the following facts
need to be considered, especially to get used to it for when we move over
to Delphi in Grade 11.
Don’t use any spaces within the name, rather capitalize each word in a
phrase e.g. Number of Fruit – should be one word NumberOfFruit.
Make use of the Underscore symbol if you want to link words e.g.
Number_Of_Fruit.
The name must be descriptive of the data expected in the variable.
Name Of Player
1Person
YourAgeThisYear
!Failed or not ?
7
ANSWER
YourAgeThisYear iAge
8
Viewing of variables
9
Viewing of variables
10
Viewing of variables
The user can manipulate the variable in the slider
mode by clicking and dragging the pointer left-right.
So the user can use the mouse as input.
11
Viewing of variables
12
Viewing of variables
13
QUESTION
14
ANSWER
15
ANSWER
16
QUESTION
17
ANSWER
18
QUESTION
slider mode?
19
ANSWER
slider mode?
Because the programme can not
is text.
20
QUESTION
variables anywhere
on the stage?
21
ANSWER
variables anywhere
on the stage?
YES 22
QUESTION
23
ANSWER
Can the viewing of the variables be
shown/hidden and vice versa while the user
is using the program?
YES
24
Assigning values to
variables
In mathematics we usually assign a value to a
variable:
x=y
25
Complete worksheet
26