Here is a SWITCH statement in an ESP8266 program I've been working on:
switch ( pktInBuffer[1] )
{
case 0: digitalWrite(SCLK,LOW); //LED ON
break;
case 255: digitalWrite(SCLK,HIGH); //LED OFF
break;
defalut:
digitalWrite(SCLK,HIGH); //LED OFF
delay( pktInBuffer[1] );
digitalWrite(SCLK,LOW); //ON -- normal state of the led
break;
}
An eagle eyed reader will have spotted that I've mis-typed "default" here as "defalut".
Interestingly, this compiles without flagging and error for me, but the "defalut case" -- reasonably enough! -- is never executed. Took me a while to find the typo
Is this a bug in the compiler's handling of the SWITCH statement, or something about the SWITCH statement that I haven't understood which allows "defalut" as a valid case?