I have a question.
I study Introduction to Arduino http://www.princeton.edu/~ffab/media___downloads_files/IntroArduinoBook.pdf and What happens if both pushbuttons are pressed? Why? Is page 49
Can you please help me?
What happens if both pushbuttons are pressed? Why?
Well, why don't you look at the code. Imagine both of the buttons are pressed, and walk through the code, line by line, asking yourself what it would do?
I know what it would do, but I'm not going to tell you, because it's not a particularly hard question, but you do need to think about it. It is absolutely something you want to understand and be aware of, and it would impede your learning programming for us to tell you; the experience of tracing out the flow of the program and asking yourself what it's doing is valuable. When writing code, you /must/ be able to inspect your code, line by line, and ask yourself what it will do in corner cases. This is a nice intro to that concept.
I had to guess that the poster's "page 49" refers to the PDF file page 49, which is really page 39 in the posted book.
I answered this, and then realized that the poster's questions are listed as a CHALLENGE question on page 41 of the posted book. I will NOT do homework for others!
For someone who understands if ... then ... else ... in the C language, the answer is obvious.
I deleted my answer.
vaj4088:
For someone who understands if ... then ... else ... in the C language, the answer is obvious.
then?
Last I checked, C didn't have 'then'... ![]()
DrAzzy is correct. The word (dare I say keyword)
"then" is implicit and not actually part of the code.
Perhaps I should have put brackets around "then",
or perhaps I should have just said:
For someone who understands if ... else ... in the C language, the answer is obvious.
I realize that there was some humor there, but I could have been more precise.
THANKS!