Page 2 of 2

PostPosted: Thu Jul 12, 2007 12:49 am
by DocRabbit
The order problem could be prevented by using either of the following:
Code: Select all
if(variable==0)
{
variable=1;
//insert other code here
}
else if(variable==1)
{
variable=2;
//insert other code here
}
...
else
{
//default code here
}


Or the switch function
Code: Select all
switch(variable)
{
case 0:
variable=1;
//other code here
break;
case 1:
variable=2;
//other code here
break;
...
default:
//default code here
}


PostPosted: Thu Jul 12, 2007 12:57 am
by DocRabbit
The order problem could be prevented by using either of the following:
Code: Select all
if(variable==0)
{
variable=1;
//insert other code here
}
else if(variable==1)
{
variable=2;
//insert other code here
}
...
else
{
//default code here
}


Or the switch function
Code: Select all
switch(variable)
{
case 0:
variable=1;
//other code here
break;
case 1:
variable=2;
//other code here
break;
...
default:
//default code here
}