Lesson contents

Store a value

Give a number a name so you can use it again.

Simple example

Start5
Result5
lesson.dart
void main() {
    final seats = 5;
    print(seats);
}
Output
5
Advertisements

Everyday examples

A bus has 12 seats. Five are taken. How many seats are free?

Start12 − 5
Result7
lesson.dart
void main() {
    final seats = 12;
    final taken = 5;
    print((seats - taken));
}
Output
7
Run the example
Terminal
dart run lesson.dart
Official documentation