-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Document ternary operator #6247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Well, it's not only about Serial.print , the ternary operator is allowed in any function if the "arguments" type is correct. However, it could be surely documented, but I'd prefer waiting until we merge some of these PRs |
I'm with @NeatNit!!
|
It would be lonely all by itself under that header. 😢 |
Definitely not under "Further syntax"; this is just a plain old operator. Maybe under "Boolean operators". |
Why not under control structures? The ternary operator is esssentially a one-line alternative to |
I'd rather not, since it's quite different from a control structure in how it's used – the statements in that section are typically used with blocks of code, which doesn't work with |
I found another strange operator and I can't find documentation, perhaps it could be gathered at the same place in future documentation :
example from https://bblanchon.github.io/ArduinoJson/doc/decoding/ |
@thedub2001 It's a range-based |
I'd classify that as "advanced C++ 'black magic' that is out of the scope of the Arduino documentation". |
Moved to arduino/reference-en#519 |
Hello I just discovered the the Serial.print() function can be used with conditional testing :
If the "test" variable is true then the output will be :
If the "test" variable is false then the output will be :
I just thought this function could appear somewhere in the Serial.print() reference documentation
The text was updated successfully, but these errors were encountered: