Multiline comments vs. Singleline comments | Sololearn: Learn to code for FREE!


Multiline comments vs. Singleline comments

Hey every, I apologize if this has already been asked a million times, just hoping for some insight. I'm some-what new to programming and was curious regarding the markings for comments. I understand that just like Javascript, // is for single line comments and /* */ is for multiline comments. My question is, can I use /* */ for single line comments as well? And is it detrimental towards me/my coding to do that or is it still acceptable? I appreciate any insight into this, and thank everyone for taking the time to read this.

6/2/2018 11:11:00 PM

Kyle Moher

5 Answers

New Answer


When working with mutli-line comments, you can generally view them as working with 1+ line(s) in your code. This means that they can be used for only one line if you want. However, I would recommend just sticking with single line comments as they will often provide with a cleaner line as opposed to sandwiching one line of text between two signs, and is often easier to read. Nonetheless, it doesn't really matter too much how you use your comments as it is still your code, and so you can use the multi-line comments for one single line.


I appreciate the answers. Thanks a bunch! :)


Yes, you can use both styles for single line comments.


Why you don't examine? Look if you always ask for information then your knowladge never gonna be more than someone who is awnsering.


do you learn php very well? what is your jab?