- Home /
Question by
zero3growlithe · Nov 22, 2011 at 06:30 PM ·
switchstatement
How to use switch statement?
I'm asking as i can't find answer, nor i don't know where to put it and how to write it so when i press a key it will jump to next case, and when switch reach end then it begans from first case. Can somebody explain me this function?
Comment
Best Answer
Answer by Zacker · Nov 22, 2011 at 08:14 PM
https://www.google.com/search?q=javascript+switch and http://unity3d.com/support/documentation/ScriptReference/Input.GetKey.html should be of help to you.
Answer by Muzz5 · Nov 22, 2011 at 08:17 PM
You use it like this:
switch (yourVariableName){
case (1) :
do stuff
break;
case (2) :
do some other stuff
break;
}
Your answer
