-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Simplify some examples #3997
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
Simplify some examples #3997
Conversation
I think the ^= and ! should be explained then. Maybe even add the old one as a comment and tell that those two pieces of code are the same. |
@Avamander the examples are intended for people who want to understand programming and are written in the easiest as possible for this reason, so I'm sorry but this PR won't be merged.. |
FYI: Not my pull request. |
These examples are for absolute beginners and the "compact" version adds complexity (even more using @tigoe @SimonePDA @shfitz |
@Avamander sorry wrong tag, it was for @ComputerNerd |
See #3368 |
@cmaglie, yes I agree, a FAQ would be good. We have this: https://www.arduino.cc/en/Reference/StyleGuide Which you could add do and/or make more prominent. |
@cmaglie Is it just the XOR compound assignment that you object to? It could also be written as
If you like the other changes I could rebase my commit to not use the XOR compound assignment and use either the above alternative or bring back the if statements. |
Me personally, I'd leave all the logical operators out of this example and introduce them later. For someone who's seeing their first if() statement, that's enough to deal with. Conciseness is less a priority for these examples than illustrating one clear concept per example. If you want to write some examples that illustrate and explain the logical operators, though, I think that'd be great. |
I noticed that some of the examples could have been written in a more concise way. This made them easier to read and shorter.
The general trend that I noticed was this:
Why not just do this instead: