NOTE: Learn more about integers and other concepts on your teacher dashboard. Each unit has an overview that explains the concept in detail. https://dashboard.kodable.com/#/curriculum/6
Variables store information in a program. You can think of variables like a box or a container with a name on them, related to the things inside. These items inside are called values, which can be stored as text or numbers. When you use a variable in a program you’re able to control the output of the program, or what a user sees.
There are different types of variables that are used in different situations: strings, integers, and arrays. There are different types of variables that are used in different situations: strings, integers, and arrays. We’re going to talk about string variables, which are a type of variable used to represent text, making it easier for programmers to read and work with.
Definition: Strings hold groups of characters, like a word or a phrase.
In Real Life: An easy way to think about strings in real life is to think about the way your brain stores people’s names. Think of a person as a variable here: a name is just like a string: it as a value that your brain uses to identify a person. Variables have values that can change, or vary, just like a person’s last name can change when they get married, or a friend starts calling then by a new nickname.
In Programming: In programming, strings allow programmers to easily store, find, and change information in a program.
In the final part of each lesson on string variables, students will independently practice storing strings, which are represented by colors. When students put a color in the command bin, they are assigning a value to the variable. Students will match the variable with an asteroid type to clear the asteroid field.
When like asteroids touch in the asteroid field, they will clear on their own. Your students need to think critically and use as few variables as possible to clear the asteroid field.
In this level, we can see how students will assign values to variables by using the colored fuzzballs on the left. Like-variables will clear on their own, so in this level, students only need to clear the yellow asteroids using a yellow string; and the blue asteroids will automatically clear on their own.
Let’s think about how strings work in programming- we can think about video games and how a game developer controls what the player sees. A character’s name, hair color and eye color are stored as strings in a video game, making it easy for programmers to know or change what variables represent specific information in the code. A programmer working on the game could type in the variable for the character’s eye color and edit the value from “blue” to “brown”, instantly changing the character’s eye color in the game.
Why We Use Strings: String variables allow programmers to easily find information in their code and reuse values in their programs. Variables can change- think vary- and strings make it easy for programmers to read and change values assigned to different variables throughout their programs.