Why I cant "switch expression of type 'irr::core::strin

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Mr.Gluck

Why I cant "switch expression of type 'irr::core::strin

Post by Mr.Gluck »

irr::core::stringw rty;

switch(rty)

why it is mistaken?
Romul

Post by Romul »

Why not use something like:

Code: Select all

stringw		string("text");

if(string.equals_ignore_case("text"))
	printf("Yeap");
else if ... and so on
Any help?
Saguman
Posts: 10
Joined: Fri Jul 23, 2004 7:48 am

Post by Saguman »

If I remember correctly switch needs integer value. For example:

Code: Select all

 irr::s32 foo = 0;

switch(foo)
{
    case 0:
        // do something
    break;
    default:
       // do something else
}
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Yes, switch is only for numeric comparisons ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply