Learn Alice in FREE step-by-step lessons.
Unit II: Creating Code

A variable is a named location in memory. In this lesson, you will learn about variables and how to use them.
Your program will declare variables, assign them values, then use them in your code.
In this chapter, you will learn about variables and how they are used to store information in an Alice program. You will learn how to declare variables, choose appropriate data types, and assign values to them. You will also explore how the values stored in variables can be changed and used throughout a program to control actions, perform calculations, and make your programs more flexible.
Objectives:
- Name the different types in Alice.
- Name variables and objects correctly.
- Declare a variable and give it an initial value.
- Use the assign statement to give a variable a new value.
- Select and use functions to ask the user a question and store the result.
- Experiment with the tools available in Alice3.
- Use constants appropriately.
Please study the material at each of the links below.
Variables: What is a variable?- Code Preferences: Change the preference to Java
- Variables for ease of modification: Use variables to make changes easier
- Variable Scope: Scope is where a variable is available
- Assign a value to a variable: Give a varaible a new value
- Data Types: Values in Alice can be string, integer, double, Boolean or any of the gallery classes.
Drill on type: See if you can select the correct type.- Name of variables: Variable names must follow rules, such as no spaces.
Drill on names: See if you can select the valid names.- Constants: Varaibles ccan change of vary. Constants can not change.
- Variables for movement: Variables are useful for any movement
- Editing variables: Add to variable
S Jointed Model as variable: The jokester can be any of the animals.
Self-Study Questions: What have you learned?
Discussion questions: What do you think?
Glossary for Variables in Alice 3
Full Glossary