Navigasi Materi

Scratch 10

Scratch Materi 10 - Variables and Data

Scratch Materi 10: Variables and Data

Variabel dan Data dalam Scratch | Understanding and Using Variables

Tujuan Pembelajaran | Learning Objectives

  • Memahami fungsi variable dalam Scratch.
  • Understand what a variable is and why it is useful.
  • Membuat dan menggunakan variable.
  • Create and use a variable in a Scratch program.
  • Menggunakan Set Variable dan Change Variable.
  • Use Set Variable and Change Variable correctly.
  • Menghubungkan variable dengan loop dan condition.
  • Connect variables with loops and conditions.

1. Apa itu Variable? | What is a Variable?

Variable adalah tempat untuk menyimpan sebuah nilai yang dapat berubah selama program berjalan.

A variable is a container used to store a value that can change while the program is running.

Score

Menyimpan nilai skor permainan.
Stores the player's score.

Timer

Menyimpan waktu.
Stores time information.

Lives

Menyimpan jumlah kesempatan.
Stores the number of lives.

2. Variable Blocks

when green flag clicked set score to 0 change score by 10 change score by 10

Set Variable digunakan untuk memberikan nilai tertentu.
Set Variable gives a variable a specific value.

Change Variable digunakan untuk menambah atau mengurangi nilai.
Change Variable increases or decreases the value.

score
20
Variable value can change during program execution.

3. Vocabulary

Scratch Term Bahasa Indonesia English Explanation
Variable Variabel A container that stores a value.
Create a Variable Membuat variabel Create a new variable.
Set Variable Menentukan nilai variabel Give a variable a specific value.
Change Variable Mengubah nilai variabel Increase or decrease a variable.
Show Variable Menampilkan variabel Show the variable on the Stage.
Hide Variable Menyembunyikan variabel Hide the variable from the Stage.

4. Practice: Let's Change the Score

Pilih tindakan dan lihat bagaimana nilai score berubah.
Choose an action and watch the score change.

score
0
Ready
score: 0
CAT

5. Challenges

Drag blocks from Block Library to the Script Area.
Jalankan program, amati Stage, kemudian klik Check.

Challenge 1: Starting Score

Goal: Buat program yang membuat score menjadi 0.
Create a program that sets the score to 0.
Block Library
when green flag clicked
set score to 0
set score to 10
change score by 10
Script Area
Drag blocks here
score: 0
CAT

Challenge 2: Collect Points

Goal: CAT bergerak dan score bertambah 10.
CAT moves and the score increases by 10.
Block Library
when green flag clicked
move 50 steps
change score by 10
change score by 5
Script Area
Drag blocks here
score: 0
CAT

Challenge 3: Repeat and Score

Goal: Gunakan Repeat 5 dan tambahkan score 10 setiap pengulangan.
Use Repeat 5 and increase the score by 10 in each iteration.
Block Library
when green flag clicked
repeat 5
change score by 10
change score by 5
Script Area
Drag blocks here
score: 0
CAT

Challenge 4: Condition and Score

Goal: Jika condition benar, CAT bergerak dan score bertambah 10. Jika condition salah, score berkurang 5.

If the condition is true, CAT moves and score increases by 10. If the condition is false, score decreases by 5.
Block Library
when green flag clicked
if else
condition
move 100 steps
change score by 10
change score by -5
Script Area
Drag blocks here
score: 0
CAT

6. Reflection

Centang pernyataan yang sesuai dengan pemahamanmu.
Check the statements that match your understanding.

7. Quiz | Kuis

1. Apa fungsi Variable dalam Scratch?
What is the purpose of a Variable in Scratch?
2. Block mana yang digunakan untuk memberikan nilai tertentu?
Which block gives a variable a specific value?
3. Jika score = 20 dan program menjalankan change score by 10, berapa score berikutnya?
If score = 20 and the program runs change score by 10, what is the new score?
4. Apa hasil dari program berikut?
set score to 0 repeat 5 change score by 10
5. Variable dapat digunakan bersama dengan apa?
What can variables be used with?