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.
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 Else
Jika kondisi benar lakukan tindakan pertama. Jika salah lakukan tindakan kedua.
If true, do the first action. If false, do the second action.
Decision
Program dapat memilih tindakan berdasarkan kondisi.
A program can choose an action based on a condition.
4. Scratch Vocabulary
Kondisi
Jika
Jika tidak
Benar
Salah
Keputusan
Nilai True atau False
Pendeteksian
Operator
5. Practice | Latihan
Pilih kondisi kemudian klik Run. Perhatikan apakah CAT bergerak.
Choose a condition and click Run. Observe whether CAT moves.
Condition
Challenge 1 - If
Buat CAT bergerak hanya jika condition bernilai True.
Make CAT move only when the condition is True.
Block Library
Script Area
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".
Block Library
Script Area
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.
Block Library
Script Area
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".
Block Library
Script Area
6. Reflection
7. Quiz | Kuis
8. Next Lesson
Scratch Materi 10 - Variables
Pada materi berikutnya kita akan belajar membuat Sprite menyimpan informasi menggunakan Variables.
In the next lesson, we will learn how to store information using Variables.