What will happen if we don't put // before the comments | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will happen if we don't put // before the comments

27th Dec 2016, 5:47 PM
Ranjana Bhaskar
Ranjana Bhaskar - avatar
5 Answers
+ 6
They won't be comments anymore.
27th Dec 2016, 5:52 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
The compiler will treat the body of code as if it were actual code. Chances are that the compiler will throw an error as the comment will contain illegal syntax. However it may not be the case, for example, x = 5 // x = 6 X will stay as 5, however if the comments were removed x will be assigned 6. This can cause other errors within a code unless you intended for that assignment to occur. This is only a small example.
27th Dec 2016, 5:52 PM
Greg Ortiz
Greg Ortiz - avatar
0
compile error
27th Dec 2016, 8:10 PM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar
0
Compiler will give you eror!!
1st Jan 2017, 5:14 PM
mohammadalisetork
mohammadalisetork - avatar
0
you could use either /* comments */ or /// or //
1st Jan 2017, 5:15 PM
Matin Zadehdolatabad
Matin Zadehdolatabad - avatar