Module 1~8 min
Variables and Data Types
Variables are how programs store and remember information. This lesson introduces variables and the basic types of data they can hold.
What You'll Learn
- What a variable is
- Common basic data types
- Why data types matter
What Is a Variable?
A variable is a named container that holds a piece of data a program can use and change while it runs. Giving data a meaningful name makes code far easier to read and work with.
Common Data Types
Common basic data types include numbers, text (called strings), and true/false values (called booleans). Programming languages use these types to determine what operations are valid on a piece of data.
Example
A variable named `age` might hold the number 25, while a variable named `name` holds the text "Sam" -- two different data types serving two different purposes.
Key Concepts
VariableStringBoolean
Key Takeaways
- A variable is a named container for data
- Common data types include numbers, strings, and booleans
- Data types determine what operations are valid on a piece of data
Knowledge Check
What is a variable?