Bug in Arduino?

The following code should print "result = 20.00", but it only prints "20.00". WHY?

float value = 20;
float result = 0;

void setup() {
    Serial.begin(9600);
}

void loop() {
  
      result = abs(value);   // avoid using other functions inside the brackets \
      Serial.print("result = ");   
      Serial.println(result);

}

It's the \ on the end of your comment. That's documented somewhere as making the next line part of the comment.

Jimbo: Thanks!
Moderator: Please add this to the Arduino Reference for comments "//".
Moderator: Also, the Arduino Reference says abs() returns -x: if x is less than 0. I think this is an error.

Also, the Arduino Reference says abs() returns -x: if x is less than 0. I think this is an error.

No, that's correct arithmetically.

Say x = -4, abs(x) is 4, which is -x (ie, --4)

Moderator: Please add this to the Arduino Reference for comments "//".

Not a moderator function, I'm afraid.
The backslash character is a line-continuation, and affects any C source line, not just comments.

Also, the Arduino Reference says abs() returns -x: if x is less than 0. I think this is an error

No, it isn't

AWOL:

Also, the Arduino Reference says abs() returns -x: if x is less than 0. I think this is an error

No, it isn't

I have a strange feeling of deja-vu here. I think this discussion has been had before.

It returns -x if x < 0. Ok, so if x is -4, what is -(-4)? 4. Therefore it has inverted it.

Remember, the x is minus already!

warren631:
Jimbo: Thanks!
Moderator: Please add this to the Arduino Reference for comments "//".

Its not really to do with comments, it's the C-preprocessor that handles all the #defines
and #ifdefs - a backslash at the end of any line makes the next line a continuation of the current line.

This is useful for defining large #define macros, since a #define has to be on one "line".

However in the rest of the C language newlines aren't important so the backslash often
has no effect except in #defines and one-line comments. I think you can put long strings
onto several lines using it too.

MarkT:
I think you can put long strings onto several lines using it too.

Adjacent string literals will be concatenated anyway. The following are equivalent:

char *a = "Hello world";
char *a = "Hello " "world";
char *a = "Hello "
                 "world";