Use // for conment | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Use // for conment

Somebody please help When we use // to directive a statement, is it just for one line ? Cause I use//and write something for 3 lines but it was diactiveted

31st Oct 2019, 9:18 AM
Armina
Armina - avatar
3 Answers
+ 7
The new line is considered after you press `enter` key. Single line comment can have many words. After typing many words cursor will move to next line but it'll not be considered as line break. edit: Armina you can try this. //Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. This is also a single line comment! but this /*lorem ipsum*/ is not single line comment! because you explicitly moved to next line by pressing `enter`.
31st Oct 2019, 9:31 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 3
// is used for only one line comment For multiple line comment use /* your code */
31st Oct 2019, 9:31 AM
Vijay Meena
+ 1
Thanks alot
31st Oct 2019, 9:34 AM
Armina
Armina - avatar