Click "Run" on any code cell to execute it and see the results
A variable is a named storage location that holds a value. In Dart, every variable has a type that determines what kind of data it can store. Variables allow you to store, retrieve, and manipulate data throughout your program.
`type variableName = value;
`When you declare a variable:
1. **Memory Allocation**: Dart reserves space in memory for the variable
2. **Type Assignment**: The variable is assigned a type
3. **Value Storage**: The value is stored at that memory location
4. **Name Binding**: The variable name becomes a reference to that location
Watch the right sidebar to see how variables are stored and modified!
Variables have scope - they only exist in the region where they are declared. In Dart, variables declared in curly braces {} only exist within those braces.
You can create constant variables with `final` or `const` keywords, making them unchangeable after assignment.
Dart can infer the type of a variable using `var` keyword:
`var message = "Hello"; // Dart infers this is a String
var count = 42; // Dart infers this is an int
`