if((somebool==true && somefunction()==true) || anotherfunction()==false) {
// do something
}
just wanted to confirm, as i know if the variable "somebool" is false, is the following function "somefunction" not being triggered but "anotherfunction" going to executed in cpp and javascript. Is it also works in world of mcu's?
another question
switch(x) {
case 1:
{} // <--- notice the brackets, code compiles without them but doesn't work.
break;
}
cpp and javascript executing that switch statement without brackets, arduino won't. why?
The brackets aren't required, although if you are declaring variables within the case block then you will need them, or you will run into variable scope issues.
This is not what you said before. Do you mean some one case has to be in braces (these [ ] are brackets, BTW) or the entire switch statement?
If one case, which? All?
Very odd no matter what. @red_car was calling your attention to the problem of declaring a variable in case code, you have not done that, so no scope issue obtains here.