Use of \\ in comments causes Trouble? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Use of \\ in comments causes Trouble?

I stumbled over this problem: As soon as I added \\ in a comment, I got a whole bunch of errors, while everything is fine without. See here: https://code.sololearn.com/c1p3B4k7Z83h/?ref=app Can anyone please explain this to me, I'm curious why this happens?

26th Oct 2017, 11:52 AM
Shadow
Shadow - avatar
3 Answers
+ 4
"If a line ends with a backslash, the following line is considered to be a continuation of that line. This is the standard behaviour." From: stackoverflow.com/questions/28821786/double-backslash-in-comment-inside-array
26th Oct 2017, 12:32 PM
Porf
Porf - avatar
+ 2
Yeah, it spawns a compiler warning: multi-line comment. I get that it looks neat. You could stick (any char, but maybe) a semicolon out there to reduce (not remove) the confusion for programmers who follow you.
26th Oct 2017, 3:50 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
Ah, I see, if I insert an empty line afterwards, everything is fine again. Thanks for your answer!
26th Oct 2017, 1:27 PM
Shadow
Shadow - avatar