Serial buffer array - What's wrong

I was under the impression that the Serial.Available was in sorts a boolean type as that is how it appears when used in code (if serial.available = True or False then process x).

Poor examples, then.

Serial.available() returns the number of bytes available to read. This works as a boolean test, since 0 is false and everything else is true, but I don't like code written this way.

So if there is no serial data in the buffer what does the Serial.avaiable() return?

  1. Zero. Zip. Zilch.

If not 0, which is apparently the first byte of the serial packet. is it "" or just empty?

It is zero, but, if you call Serial.read() anyway, it returns -1.

By the way, you have the source code for all the Arduino functions/classes, so you could look at the code or the documentation, instead of making assumptions.