Skip to content
KodeTrail

Camp 1 · Step 2 of 12

Hello, Dart!

Entry points, printing, comments, and string interpolation — the everyday toolkit.

10 min+50 XP

Let's get fluent in Dart's daily basics — they'll feel comfortable within minutes.

The shape of a program

DartCloud run
  • void main() { } — execution starts at main; void means it returns nothing
  • print(...) — one line of output each call
  • Statements end with ;, comments start with //
  • Strings take single or double quotes — Dart style favors single

Interpolation: strings that compute

Dart's $ syntax builds strings beautifully:

DartCloud run

$variable drops a variable straight into the text. For full expressions, wrap them in braces:

print('${km * 1000} meters!');   // expressions need ${ }
print('$name');                  // bare names don't
Checkpoint

Where does a Dart program start executing?

Checkpoint

Which prints the RESULT of 2 + 3 inside a string?

What's next

Variables: var, final, and why Dart wants to know what can change.