Hey all,
I read the wiki about using the switch statement and use it frequently in other languages I code in but this has me puzzled; I am using a switch with a string argument to do mass comparisons but receive errors. I think my problems here are the crappy way that smalltalk/source mod handles data types. Also i know you have to use a function to do a string comparison ie. strcmp -- so I am not sure what hack to use, but needless to say this doesn't work as expected:
Code:
switch(str){
case "apple":{PrintToChatAll("\x04Apples");break; }
case "banana":{PrintToChatAll("\x04Banana");;break; }
case "beer":{PrintToChatAll("\x04Beer");;break; }
case "milk":{PrintToChatAll("\x04Milk");;break; }
default:{PrintToChatAll("\x04Fail");}
}
Edit: oops thought I clicked on source mod scripting, can someone put it in that section?
__________________