Hi, I am from many many years of Pascal and we have "Sets" such that I can see if a number is in a range. Is there anything like this in Arduino/C++
x:=6;
if x in [1,2,3,5,7,8,9] then.... This would be False
We also can use a range as in.
if x in [1..3,5..9] then.... This would also be False
How can I do this in C++ without using multiple single if-checks?
OK, thanks. When I searched online looking for "Sets" it came up with all manner of things, very few with anything to do with programming. 
switch(x)
{
case 1 ... 9:
Do stuff;
break;
case 10 ... 12:
Do stuff;
break;
This is kind of close.
Arduino switch case allows number ranges but it's not in the Arduino Reference.
From the forum, this works with Arduino:
int var = DMXSerial.read(FIVE);
switch (var) {
case 0 ... 5:
runBlack();
break;
case 6 ... 10:
runR();
break;
default:
// if nothing else matches, do the default
// default is optional
break;
}
Tables can be great for speed (love em!) but do take memory though that can be flash instead of RAM. If you can come up with a fast formula (or don't need great speed and have a formula) then it's better to do that.
if ( serial.available() )
{
myDataChar = serial.read();
if ( myDataChar >= '0' & myDataChar <= '9' )
{
// serial data is a numeral
}
}
Yes, there is. In the Boost library.