Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Dart Comments | First Acquaintance with Dart
Introduction to Dart

bookDart Comments

Developers often need a tool to make their code easier to understand. It's often helpful for himself and the people he works with on code. A comment is a text that the Dart interpreter ignores, allowing us to explain parts of the code. There are several main uses for comments.

An explanation of what the code does:

main.dart

main.dart

copy
123
void main() { print('Correct'); // Output word "Correct" to console }

We often comment out code blocks to avoid errors at runtime:

main.dart

main.dart

copy
12345
void main() { print('Hello, World!'); //; print Hello, World!"'() print("Hello, World!"); }

Code Syntax

Dart supports single-line comments // and multi-line comments /* */.

Single-line comment:

main.dart

main.dart

copy
123
void main() { print('info'); // Output 'info' to console }

Multi-line comment:

main.dart

main.dart

copy
12345
void main() { /* Multi-line comment */ print("Very useful topic"); }
question mark

How many times will the word Dart be displayed in the console?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 4

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Awesome!

Completion rate improved to 4.55

bookDart Comments

Pyyhkäise näyttääksesi valikon

Developers often need a tool to make their code easier to understand. It's often helpful for himself and the people he works with on code. A comment is a text that the Dart interpreter ignores, allowing us to explain parts of the code. There are several main uses for comments.

An explanation of what the code does:

main.dart

main.dart

copy
123
void main() { print('Correct'); // Output word "Correct" to console }

We often comment out code blocks to avoid errors at runtime:

main.dart

main.dart

copy
12345
void main() { print('Hello, World!'); //; print Hello, World!"'() print("Hello, World!"); }

Code Syntax

Dart supports single-line comments // and multi-line comments /* */.

Single-line comment:

main.dart

main.dart

copy
123
void main() { print('info'); // Output 'info' to console }

Multi-line comment:

main.dart

main.dart

copy
12345
void main() { /* Multi-line comment */ print("Very useful topic"); }
question mark

How many times will the word Dart be displayed in the console?

Select the correct answer

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 4
some-alt