-
-
Notifications
You must be signed in to change notification settings - Fork 732
Document ternary operator #519
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
EDIT: see following reply for my updated opinion
|
In my previous reply, I was operating under the understanding that the .ino files of Arduino sketches were written in C++, and therefore it was reasonable to expect the users to use C++ references in conjunction with the Arduino Language Reference. Since that time, I was informed that .ino files are written in Arduino Language, not C++. The Arduino Language Reference is the sole official and comprehensive documentation of this Arduino Language that exists on the Internet. Thus, any feature of the Arduino Language is a valid and necessary subject for the Arduino Language Reference, including the ternary operator. |
@per1234 I went through the relevant discussions mentioned in the comment section of this issue. I also wanted to suggest that ternary operator should be present under a separate section Ternary Operator since we're having a section named Boolean Operators that represents two arguments based evaluation, so since ternary works on three-argument so it should have a separate section. Please guide me. Waiting for feedback and review. |
It looks pretty good. I would request that you use the Arduino IDE's Tools > Auto Format (or Ctrl + B in the Arduino Web Editor) to correctly format your example code.
There is some good discussion about the correct section for this documentation in arduino/Arduino#6247, but unfortunately no consensus. The proposed locations:
I haven't formed an opinion on this, though control structures is appealing to me.
I think it would be good to have a pull request for this, but I would like to get some input from someone else at Arduino before merging it so it might sit a while or even never get merged. It's really dependent on the decision regarding #623. If we were to decide to go with my first proposal to solve that issue, then it would not be necessary to add documentation for the ternary operator, since the external C++ reference will document it. If we are going with my second proposal for solving that issue, then we absolutely need to add documentation of the ternary operator. The default alternative is to stick with the current approach of not completely documenting the Arduino programming language. In that case, we need to decide on a case by case basis which things should be in the Arduino Language reference. Unfortunately, I have not gotten any input on that issue yet. If no decision is made, then we stick with the default and I would then likely be in support of adding your page, since this seems to be one of the most popular requests. |
Thanks a lot for the review. Yes, I've modified the example code using the Web Editor. Here is the link to the file:
Definitely, I can understand. I'll be eagerly waiting for someone else from Arduino to review and express his/her views on the PR. |
Migrated from arduino/Arduino#6247
I'm going to leave off the text of the original issue because it was written under the misunderstanding that this is a feature specific to
Serial.print()
. However, there are some valuable replies in that thread in support of adding this page to the Language Reference and discussing which section it should be placed in.Related:
The text was updated successfully, but these errors were encountered: