Single Line and Multi Line Comments in Dart Programming Language | Importance of Comments in Programming
Hello everyone!
Today I am here to share single line comments and multi line comments in dart programming language. I will also highlight the usage and importance of the commented code or comments.

Importance of Comments in Dart Programming Language
In daily life we use comments in different ways like on social media and in real life to explain anything or add some extra information.
In all programming languages we use comments to explain the code or to identify the specific block of ode easily. The compilers do not compile the commented code. With respect to the language the syntax of the single line and multi line comments is different.
Similarly in Dart programming language we use comments. The syntax of the comments in dart programming language is very easy. When we write a lot of code then it becomes difficult to find a specific code according to their working. So we use comments to specify the code with respect to their function. Sometimes if we do not need a specific block of code at the moment then we can also comment that code and the compiler will not execute that code.
Syntax of Comments in Dart Programming Language
There are two types of comments in Dart programming language.
- Single Line Comments
- Multi Line Comments
Single Line Comments: As from the name we can guess that this is a comment which is used to comment a single line of code or any simple text. If we want to comment a single line of code in the dart programming language then we have to use two forward slashes "//" at the start of the line. It will comment out that line and the compiler will not compile that commented line of code.

Here you can see I have used a single line comment. I used print statement 5 times and in each I used a number to represent the print line number. Here if you notice I have used a single line comment. I have highlighted that with the yellow colour. This line of code was commented and the compiler did not compiled it and you can see the line 3 was not printed as output.
Multi Line Comments: If we want to comment more than one line of code then we use multi line comment option. It is also very simple and easy. We use a forward slash and star "/*" at the start of the first line from where we want to start commenting and similarly we use a star and forward slash "*/"at the end of the line where we want to end the comment. All the lines between these points will be commented and the compiler will not compile them.

Here you can see that I have used multi line comment. I have commented code line from 3 to 5 where the three lines of code starting from print statement 2 and print statement 4 are included.
Then focus on the output the only two lines are printed as a result instead of all 5 lines. The compiler skipped three print statements but printed only print statement 1 and print statement 5.
This is how we can use comments in the dart programming language. If we want to comment only a single line of code then we can use single line comment otherwise we can use multi line comment method.
I have tried to explain everything completely but if you still have doubts you can ask me. Thank you.
All Dart Lectures
| Lecture 1 | ![]() | Write "Hello World!" Program in Dart programming Language using VS Code |
|---|

🎉 Congratulations!
Your post has been upvoted by the SteemX Team! 🚀
SteemX is a modern, user-friendly and powerful platform built for the Steem community.
🔗 Visit us: www.steemx.org
✅ Support our work — Vote for our witness: bountyking5
🎉 Congratulations, @mohammadfaisal!
Your post Single Line and Multi Line Comments in Dart Programming Language | Importance of Comments in Programming was rewarded by CCS Curation Trail
“Home is where your heart is ❤️.”
👉 Join the CCS Curation Trail | Community Invitation
✅ Vote for visionaer3003 as witness