Tải bản đầy đủ (.ppt) (47 trang)

Programming Scratch

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (510.5 KB, 47 trang )

Programming & Scratch


Programming
Learning to program is ultimately about
learning to think logically and to
approach problems methodically.
The building blocks out of which a
programmer constructs solutions,
meanwhile, are relatively simply.


Problem-Solving and Project-Design Skills

logical reasoning
breaking complex problems into simpler
parts
debugging problems
developing ideas from initial conception
to completed project
sustained focus and perseverence


Fundamental Ideas about Computers and Programming

computer programs tell the computer
precisely what to do, step-by-step
writing computer programs doesn’t require
special expertise, just clear and careful
thinking



Programming
Common in programming, for instance,
are "loops" (whereby a program does
something multiple times) and
"conditions" (whereby a program only
does something under certain
circumstances. Also common are
"variables" (so that a program, like a
mathematician, can remember certain
values).


Statements
In programming, a statement is simply a
directive that tells the computer to do
something. Think of it as a command or
an instruction. In Scratch, any block
whose label reads like a command is a
statement.


Statements
One such block instructs a sprite to say
something:


Statements
Another such block instructs a sprite to
go to some location:



Sequence
To create a program in Scratch, you need to
think systematically about the order of steps


Boolean Expression.
In programming, a Boolean expression
is an expression that is either true or
false. In Scratch, any block shaped like
an elongated diamond is a Boolean
expression.
One such block is:


Boolean Expression.
Another such block is:

After all, it is either true that some
number is less than another number or
it is false.


Boolean Logic
and, or, or not are examples of boolean
logic.


Conditions

In programming, a condition is
something that must be true in order for
something to happen. A condition is
thus said to "evaluate to true" or
"evaluate to false." In Scratch, any block
whose label says "if," "when," or "until"
is a sort of conditional construct.


Conditions
One such block is:


Conditions
The previous construct is generally
known as an "if construct." With it can
we instruct a sprite to say hello only if,
say, the user has depressed the mouse
button:


Conditions
A related construct is the "if-else
construct":


Conditions
With the previous construct can we
instruct a sprite to say hello or goodbye,
depending on whether the user has

depressed the mouse button:


Conditions
Realise that these constructs can be nested to allow, for example, for
three different conditions. This construct could be called an "if-else ifelse construct".


Conditions
Another conditional block is:

Yet another such block is:


Conditional Statements
if, forever-if, if-else repeat-until and
waituntil check for a condition



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×