Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
does a case (switch statement) has to be "case 1/2/3/...)?
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: does a case (switch statement) has to be "case 1/2/3/...)?

I'm pretty sure the case label has to be an integer value. You can probably use characters, such as case 'x', but a character is really an integer value anyways, it is just displayed differently.

For more complex logic like what you described in the second code box, you'll want to use if-else statements. They can get a little sore on the eyes, reading through a bunch of if-elses but they get the job done.

02-21-2013, 09:05 PM
Find


Messages In This Thread
RE: does a case (switch statement) has to be "case 1/2/3/...)? - by palistov - 02-21-2013, 09:05 PM



Users browsing this thread: 1 Guest(s)