Professional Documents
Culture Documents
Example Lesson Slides
Example Lesson Slides
Session 3
Variables
What did we do last time?
Warm Up Activity: Loops
Level Check-in
2
What do you think we’ll be
doing on today’s quest?
3
Today’s Quest
Warm Up Activity: Variables
Level Check-in
4
Variables
Coi
ns
5
Variables
Variables are a way for us to keep track
of information in our code, such as Variable
numbers and words.
coins = 3
6
Variables
What kind of information do you need to track every day? How can they be stored as
variables?
7
Story Builder
Our Variables
● age =
● name =
● song =
● food =
● number =
8
Story Builder
Our Variables
Once upon a time, there was a [age] old coder named [name].
● age = [name] liked to hum the song [song] while coding. It was so
annoying that their teammates would throw [food] until [name]
● name = would stop singing.
● song = Still, [name] was the best coder on the team and could write
[number] lines of code every day. Maybe [song] was [name]’s
● food = secret power?
9
Concept Check: Variables
In this example, what part of the image is the variable, the name, and the value?
Variable
a way to store information in our program
so we can use it later
Name
we give each variable a name so we can
keep track of different ones
Pencils
Value
the information that you store inside a variable
that you can change over and over again
10
Numbers & Variables
There are different types of numbers that can be stored by variables.
Sort the data! Which ones are strings? Which ones are integers? Which ones are variable
names?
helloWorld l33t
“name”
1337
steps “Hello, world!”
“l33t” “steps”
10,423 friend
Methods with Information
Some methods return different kinds of information such as strings or numbers. You can
store that information into a variable.
enemy = hero.FindNearestEnemy()
3 You can store that string 1 The method finds the enemy
inside a variable. Now, that is nearest to the hero
enemy has the value 2
14
Let’s get back to the dungeon!
15
Review: How to Use CodeCombat
1
4
2 5
16
Level 15
https://codecombat.com/play/level/known-enemy?
17
Independent Practice
18
Independent Practice
Play Levels
CS1 Levels 16-18
Need Help?
Always try it once before asking for help.
19
Check-In
20
What did you discover?
What I did:
-How many levels did you finish? What was your favorite level?
What I noticed:
-What did you notice as you played through the levels?
-Did you discover or learn something new?
21
Quest Wrap-Up
Warm Up Activity: Variables
Level Check-in
22
Any Questions?
23