← → or space · progress saves for Continue on the roadmap
Goal
Use Dart’s basic types for numbers, text, and true/false.
Step 1 — int (whole numbers)
void main() {
int age = 20;
int count = -5;
print(age);
print(count);
}- Use
intfor whole numbers (no decimal).
Step 2 — double (decimal numbers)
void main() {
double price = 9.99;
double temperature = -3.5;
print(price);
print(temperature);
}- Use
doublefor numbers with a decimal part.
Step 3 — String (text)
void main() {
String name = 'Alice';
String greeting = "Hello!";
print(name);
print(greeting);
}- Use single or double quotes for strings.
Step 4 — bool (true/false)
void main() {
bool isActive = true;
bool isEmpty = false;
print(isActive);
print(isEmpty);
}- Use
boolfor conditions and flags.
Quick reference
| Type | Example values |
|---|---|
int |
0, 42, -10 |
double |
3.14, -0.5 |
String |
'hi', "world" |
bool |
true, false |
Practice tasks
- Declare an
intfor your age and print it. - Declare a
doublefor a price and print it. - Declare a
Stringfor your name and print it. - Declare a
booland print it.