Using or statements within switch statements
i have been writing code morse code flasher. in on section of code have serial monitor take capital or lowercase letter. problem gives me error of duplicate case value. not possible use or statements within switch statement this.
case
'a'|| 'a' :
serial.println ('a');
dot();
dash();
letterspace();
break;
case
'a'|| 'a' :
serial.println ('a');
dot();
dash();
letterspace();
break;
the problem gives me error of duplicate case value. not possible use or statements within switch statement this.
case
'a'|| 'a' :
serial.println ('a');
dot();
dash();
letterspace();
break;
what want this
code: [select]
switch (var) {
case 'a':
case 'a':
//do when var equals a/a
break;
case 'b':
case 'b':
//do when var equals b/b
break;
default:
// if nothing else matches, default
// default optional
}of course should really study code posted in other thread liudr.
hope helps,
brad.
Arduino Forum > Using Arduino > Programming Questions > Using or statements within switch statements
arduino
Comments
Post a Comment