Give a word a name to use in the program using is. You can choose the name yourself.
Ask something with ask. Beware! You need to give the answer a name with is.
sleep let Hedy pause for a (couple of) second(s).
Give a number a name using is. You can choose the name yourself.
Introduction
Rock, paper, scissors
Parrot
Story
Haunted House
Restaurant
Turtle
Puzzle
Quiz
In level 2 we learn two new commands: is and sleep.
You can name a word with is. This is called a variable. In this example we made a variable called name and a variable called age. You can use the word name anywhere in your code and it will be replaced by Hedy, like this:
This way you no longer need the echo command!
name is Hedy
age is 15
print name is age years old
print still works the same, but the ask command has changed. You need to use a variable in the ask command as well. It looks like this:
answer is ask What is your name?
print Hello answer
Another new command in this level is sleep, which pauses your program for a second. If you type a number behind the sleep command, the program pauses for that amount of seconds.
print My favorite colour is...
sleep 2
print green!
In this level you can practise using the variables, so that you can make the rock, paper, scissors game in the next level!
_ is ask rock, paper, or scissors?
print I choose _
Exercise
Copy the example code to your input screen by clicking the yellow button.
Finish the code by filling in the right commands on the blanks.
Create your own online pet parrot that will copy you!
print Im Hedy the parrot
name is ask whats your name?
print name
sleep
print squawk
sleep
print name
Exercise
You can use variables to make the parrot say more than only your name. Can you complete this code?
print Im Hedy the parrot
name is ask whats your name?
print name
sleep
print name
surname is ask whats your surname?
_
sleep
_
In level 2 you can make your story more fun. Your main character's name can now be anywhere in the sentence.
You do have to program a little bit extra for that. You must now name your main character first.
You can then put that name anywhere in a sentence.
name is ask What is the name of the main character?
print name is now going to run in the woods
print name is a bit scared
print Suddenly he hears a crazy noise...
sleep
print name is afraid this is a haunted forest
Exercise
Now it's time to add variables to your own story that you've made in the previous level.
Go to 'My programs', look for your level 1 story adventure and copy the code. Paste the code in your input screen in this level.
This code won't work in this level, because you have not used variables yet.
Change the ask commands and echo commands in your code to the correct form that you've learned in this level.
Extra Add a sleep command to your code to build up tension in your story.
In this haunted house you can choose your monsters with emojis. Of course you could also use words.
monster_1 is 👻
monster_2 is 🤡
monster_3 is 👶
print You enter the haunted house.
print Suddenly you see a monster_1
print You run into the other room, but a monster_2 is waiting there for you!
print Oh no! Quickly get to the kitchen.
print But as you enter monster_3 attacks you!
Exercise
In the example above the monsters are predetermined. So each time you run your code, the output is the same.
Can you add ask commands to make the haunted house interactive and have the players choose the monsters they come across?
monster_1 is _
monster_2 is _
monster_3 is _
print You enter the haunted house.
print Suddenly you see a monster_1
print You run into the other room, but a monster_2 is waiting there for you!
print Oh no! Quickly get to the kitchen.
print But as you enter monster_3 attacks you!
In level 2 you could expand your restaurant by using variables. In level 1 Hedy could only echo the order once and only remember the last thing that was ordered.
Now you can use variables and Hedy can remember both the food and the toppings!
print Welcome to Hedy's restaurant!
print Today we're serving pizza or lasagna.
food is ask What would you like to eat?
print Great choice! The food is my favorite!
topping is ask Would you like meat or veggies on that?
print food with topping is on its way!
Exercise
Copy your own restaurant code from to previous level to the input screen below.
Fix the code by replacing the ask and echo commands and using variables, like you've learned in this level.
Now that your code is working again, it's time to add something more.
Look at the last line of the example code: print food with topping is on its way!
In this single line 2 variables have been used to create a summary of the order.
Now add your own summary of the food and drinks ordered by the customer.
Extra Now that you've learned how to use variables, you can use as many variables in one line as you'd like. Can you add more variables to your code, like eat in or take-away, cash or card, with or without a straw etc.?
In this level you can use variables to make the turtle interactive. For example you can ask the player how many steps the turtle must make.
answer is ask How many steps should the turtle make?
forward answer
Also, in level 1 the turtle could only turn left or right. That is a bit boring!
In level 2 he can point his nose in all directions.
Use 90 to turn a quarter. We call this degrees. A full turn is 360 degrees.
Exercise
Can you make a figure with this code? Maybe a triangle or a circle?