Navigasi Materi

Scratch 9

Scratch Materi 9 - Conditions and Decision Making

Scratch Materi 9

Conditions and Decision Making

Belajar membuat Sprite mengambil keputusan berdasarkan suatu kondisi.

Learn how to make a Sprite make decisions based on a condition.

1. Tujuan Pembelajaran | Learning Objectives

Condition

Memahami bahwa program dapat memeriksa suatu kondisi.

Understand that a program can check a condition.

If

Menggunakan if untuk menjalankan perintah ketika kondisi benar.

Use if to run a command when the condition is true.

If Else

Membuat Sprite melakukan tindakan berbeda berdasarkan kondisi.

Make the Sprite perform different actions depending on the condition.

2. Apa itu Condition?

Condition adalah keadaan yang diperiksa oleh program. Hasilnya dapat berupa True atau False.

A condition is something that a program checks. The result can be True or False.

when green flag clicked
if
condition
move 50 steps

Jika condition bernilai True, Sprite menjalankan perintah move 50 steps.

Jika condition bernilai False, Sprite tidak menjalankan perintah tersebut.

3. If dan If Else

If

Jika kondisi benar, lakukan perintah.

If the condition is true, perform the command.

if
move 50 steps

If Else

Jika kondisi benar lakukan tindakan pertama. Jika salah lakukan tindakan kedua.

If true, do the first action. If false, do the second action.

if else
say "Yes"
say "No"

Decision

Program dapat memilih tindakan berdasarkan kondisi.

A program can choose an action based on a condition.

4. Scratch Vocabulary

Condition
Kondisi
If
Jika
Else
Jika tidak
True
Benar
False
Salah
Decision
Keputusan
Boolean
Nilai True atau False
Sensing
Pendeteksian
Operator
Operator

5. Practice | Latihan

Pilih kondisi kemudian klik Run. Perhatikan apakah CAT bergerak.

Choose a condition and click Run. Observe whether CAT moves.

Condition


Condition: True
Practice Stage
CAT
Ready

Challenge 1 - If

Buat CAT bergerak hanya jika condition bernilai True.

Make CAT move only when the condition is True.

Choose Condition

Block Library

when green flag clicked
if
condition
move 50 steps

Script Area

Drag blocks here
Challenge 1 Stage
Condition: True
CAT
Ready
Build the script and run it.

Challenge 2 - If Else

Jika condition True, CAT bergerak. Jika False, CAT mengatakan "I will stay here".

If the condition is True, CAT moves. If False, CAT says "I will stay here".

Choose Condition

Block Library

when green flag clicked
if else
condition
move 80 steps
say "I will stay here"

Script Area

Drag blocks here
Challenge 2 Stage
Condition: True
CAT
Ready
Build the script and run it.

Challenge 3 - Repeat and If

Gabungkan Materi 8 dan Materi 9. CAT bergerak empat kali jika condition bernilai True.

Combine Lesson 8 and Lesson 9. CAT moves four times when the condition is True.

Choose Condition

Block Library

when green flag clicked
repeat 4
if
condition
move 30 steps

Script Area

Drag blocks here
Challenge 3 Stage
Iteration: 0 / 4
CAT
Ready
Build the script and run it.

Challenge 4 - If Else Decision

Buat CAT mengambil keputusan. Jika True, CAT bergerak dan mengatakan "Success". Jika False, CAT tetap di tempat dan mengatakan "Try again".

Make CAT make a decision. If True, CAT moves and says "Success". If False, CAT stays and says "Try again".

Choose Condition

Block Library

when green flag clicked
if else
condition
move 100 steps
say "Success"
say "Try again"

Script Area

Drag blocks here
Challenge 4 Stage
Decision: True
CAT
Ready
Build the script and run it.

6. Reflection

7. Quiz | Kuis

1. Apa fungsi condition?
What is the purpose of a condition?
2. Jika condition pada if bernilai False, apa yang terjadi?
What happens when the condition in if is False?
3. Apa fungsi if else?
What is the purpose of if else?
4. Jika condition True, apa yang dapat dilakukan Sprite?
If the condition is True, what can the Sprite do?
5. True dan False merupakan nilai yang disebut...
True and False are values called...