Printing, Comments, and Statements
Use print, comments, and semicolons correctly.
Printing, Comments, and Statements is a free Dart Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Dart Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Talking to the Console
The print function is how your program speaks to you. Whatever you pass to it appears in the console. 🗣️
void main() {
print('Learning Dart!');
}Printing Different Values
You can pass print more than text. Give it a number or a calculation and it shows the result on screen.
void main() {
print(42);
print(2 + 3);
}Each print Is One Line
Every print call ends with a new line, so two prints stack neatly one above the other in your output.
What Statements Are
A statement is a single instruction for Dart, like printing a line. Programs are simply many statements run in order.
The Mighty Semicolon
Every statement must end with a semicolon. Forget it and Dart shows an error, because it cannot tell where one instruction ends.
Statements Run Top to Bottom
Dart runs your statements in order, from the top of main downward. The sequence you write is the sequence that happens.
void main() {
print('First');
print('Second');
}What Comments Are
A comment is a note for humans that Dart completely ignores. Use it to explain why your code does what it does.
Single-Line Comments
Start a quick note with two slashes. Everything after them on that line is a comment and never runs.
void main() {
// This greets the user
print('Hi!');
}Multi-Line Comments
For longer notes, wrap text between slash-star and star-slash. This block comment can span as many lines as you need.
/* This whole block
is ignored by Dart */Commenting Out Code
Comments also let you disable a line temporarily while testing. Dart skips it, yet your code stays safely in the file.
void main() {
// print('skipped');
print('shown');
}Good Comments Help
Clear comments make code easier to revisit later. Explain the why, not the obvious what, and your future self will thank you. 🙏
Quick Check
Let's test your single-line comment skills.
Recap
You used print to show output, ended each statement with a semicolon, and added comments that Dart skips. Your basics are solid! 🎉
Frequently asked questions
Is the “Printing, Comments, and Statements” lesson free?
Yes — the full text of “Printing, Comments, and Statements” is free to read here on the web, and the Dart Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Dart Academy course, upgrade to CoddyKit PRO.
What will I learn in “Printing, Comments, and Statements”?
Use print, comments, and semicolons correctly. You practise Dart Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Dart Academy?
No prior experience is required. Dart Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Printing, Comments, and Statements” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Dart Academy lesson?
Yes. Every Dart Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Dart Is and Why It Exists
- Install the SDK and Check Your Version
- Anatomy of main() and Hello World
- Printing, Comments, and Statements