Imagine the pin is an input, with pullup.
So, a closed switch returns LOW, or false in your parlance.
S'gonna make a nonsense of the naming of the variable you assign it to, dontcha think?
Hello
You are right. The function digitalRead() will return either HIGH or LOW. These results can be interpreted as TRUE or FALSE.
Have a nice day and enjoy coding in C++.
AWOL, You’re absolutely right, and this unfortunately is where the Arduino school is teaching ‘half truths’ to beginners. (or half falses)
This falls back to the fundamental zero/non-zero case… false or true which emerged long before Arduino… simple tests in machine language to ‘branch’ in code.
Luckily the true/false test interprets the int (or other numeric type) to the correct state for the test.
It’s not ideal, but as long as the 0/1 test holds true, the language holds together.
I hate to think what would happen if this was changed in the C standard, maybe 80% of all C derived code would fail !