PDA

View Full Version : Switch..case statement???



ShadowMancer
06-05-2007, 12:43 AM
from what i understand zscript is basically the C language with built in functions, so why does it not seem to understand a switch statement?

example of code i wrote:



switch (best_dir)
{
case 1:
for (int n = 1 ; n<16 ; n+=4)
{
this_ffc->y-=4
Waitframe();
}
break;
case 2:
for (int n = 1 ; n<16 ; n+=4)
{
this_ffc->x-=4
Waitframe();
}
break;
case 3:
for (int n = 1 ; n<16 ; n+=4)
{
this_ffc->y+=4
Waitframe();
}
break;
case 4:
for (int n = 1 ; n<16 ; n+=4)
{
this_ffc->x+=4
Waitframe();
}
break;
}


Am i useing this wrong or is it not possible to use switch
(or is it select..case, i always get confused when useing different languages :rolleyes: )

DarkDragon
06-05-2007, 01:01 AM
Because I haven't implemented it yet.

Switch is very nasty to implement in a compiler, as it's complex both in terms of syntax and semantics, and so didn't make ZScript's first cut. Which is not to say I won't get around to it in the future.