Night 2: Give your pet a name
You already finished this night, in Python or pseudocode. It counts for both. Practise again if you like.
Tonight: give your pet a name
- Last night your pet woke up. Tonight it gets a name.
- You will learn one thing: variables.
Words for tonight
| Word | Meaning |
|---|---|
| variable | a box with a name; it keeps a value |
| value | what is inside the box, like "Lumi" or 7 |
| type | what kind of value the box keeps: STRING is text, INTEGER is a whole number |
A box with a name
- First make the box:
DECLARE, the name,:, then the type. - Then put a value in it with the arrow
←. It means put into the box. - You can type
<-. The editor turns it into←.
DECLARE PetName : STRING
PetName ← "Lumi"
OUTPUT PetName
OUTPUT PetNamehas no quotes. So you see what is in the box.

Quotes or no quotes?
- With quotes, you get the word itself.
- Without quotes, the computer looks for a box with that name.
DECLARE PetName : STRING
PetName ← "Lumi"
OUTPUT "PetName"
OUTPUT PetName
Output two things
- Put a comma between the things after
OUTPUT. - The comma joins them with no space. So put the space inside the quotes:
"Hello, ".
DECLARE PetName : STRING
PetName ← "Lumi"
OUTPUT "Hello, ", PetName
A new value
- You can put a new value in the same box.
- The old value is gone. The box keeps only the newest one.
DECLARE Mood : STRING
Mood ← "sleepy"
Mood ← "happy"
OUTPUT Mood
Good names
- Start with a capital letter. Join words with no space:
PetName,BestFood. - Do not start with a number.
- Use the same spelling every time you use the name.
Now you try
- Do the tasks below. Press Run, then Check answer.
- When all tasks pass, your pet knows its name.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The box PetName is declared. Put the text "Lumi" in it with ←.
実行ボタンをクリックして出力を確認してください。
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
PetName 保持する "Lumi". Output My name is and the name on one line, so the output is My name is Lumi. Use the variable, not the word Lumi.
実行ボタンをクリックして出力を確認してください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Your pet wants a new name. Put "Nova" in PetName on the empty line. Do not change the OUTPUT line. The output should be Hi, I am Nova.
実行ボタンをクリックして出力を確認してください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Declare two STRING variables, PetName かつ Food. Put "Kit" in PetName かつ "apples" in Food. Then output Kit likes apples using 両方 variables.
実行ボタンをクリックして出力を確認してください。