John,
I think SELECT/CASE for multiples is easier to code and understand.
Marcus,
I guess this is what you are asking?
James
$ONEXIT "GCTDC.BAT $FILE$ -m32"
SET IA[] As int
0,1,2,3,4,5,6,7,8,9
END SET
SET B$[]
"apples",
"oranges",
"pears",
"cabbage",
"peas",
"beans"
END SET
Dim A$
Dim N As int
A$ = "peas"
SELECT CASE A$
CASE B$[0],B$[1],B$[2]
Print "Fruit"
CASE B$[3],B$[4],B$[5]
Print "veggie"
End Select
N=6
SELECT CASE N
CASE 1 TO 5
Print "Greater Than zero and less than 6"
CASE IA[8]
Print "Is it eight?"
CASE IA[6] TO IA[7]
Print " 6-7"
CASE ELSE
Print "A problem"
End Select
Pause
translates to
..snip....
static int N;
static char A[cSizeOfDefaultString];
static int IA[]=
{
0,1,2,3,4,5,6,7,8,9
};
static char B[][cSizeOfDefaultString]=
{
"apples",
"oranges",
"pears",
"cabbage",
"peas",
"beans"
};
int main(int argc, char *argv[])
{
strcpy(A,"peas");
if(str_cmp(A,B[0])==0 || str_cmp(A,B[1])==0 || str_cmp(A,B[2])==0)
{
printf("%s\n","Fruit");
goto L1000;
}
if(str_cmp(A,B[3])==0 || str_cmp(A,B[4])==0 || str_cmp(A,B[5])==0)
{
printf("%s\n","veggie");
}
L1000:; // SelectState[PusherSelectState].CaseFlag 2
N= 6;
if(N>=1&&N<=5 )
{
printf("%s\n","Greater Than zero and less than 6");
goto L1001;
}
if(N==IA[8])
{
printf("%s\n","Is it eight?");
goto L1001;
}
if(N>=IA[6]&&N<=IA[7])
{
printf("%s\n"," 6-7");
}
else // case else
{
printf("%s\n","A problem");
}
L1001:; // SelectState[PusherSelectState].CaseFlag 3
Pause();
return 0; /* End of main program */
}