contents   index   previous   next



Literal Strings and switch statements

 

If either a switch expression or a case expression is a literal string, then the case statement match is based on a string comparison using Clib.strcmp() logic. The following fragment illustrates.

 

switch(Clib.strlwr(temp, argv[1])) 

{

case "add":

{

   DoTheAddThing();

   break;

}

case "remove":

{

   DoTheRemoveThing();

   break;

}

default:

{

   Clib.puts("Whaddya want?");

}

}

 


Structures