Raised This Month: $ Target: $400
 0% 

Switch and Case


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Votorx
Senior Member
Join Date: Jun 2004
Old 02-02-2005 , 13:12   Switch and Case
Reply With Quote #1

Im tryin to use switch() and case: in my code to make it neater and more compact but I keep gettin numerous errors with it no matter how I change it around. Can someone post the right method of usin switch() and case in smalls?
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 02-02-2005 , 14:54  
Reply With Quote #2

I think I've been using this:

Code:
switch (x) { case 1:    Yams case 2:    Turtle case 3:    {       OLOLOL!       OMGOMGOMG!    } }
__________________
hello, i am pm
PM is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 02-02-2005 , 22:45  
Reply With Quote #3

wow... that was very helpful pm LOLZ
__________________
Anything that is done can only be done better by urself - since life is a opinion make it the way urs feel its best

~live by it
Da Bishop is offline
Send a message via MSN to Da Bishop
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-02-2005 , 23:51  
Reply With Quote #4

isnt it like case1: statement or

case1:
{
statements
}

does Case1:
statement
Case2: work?

Also, why are some of the smart peopel here now belong to the member group of a pet... like PM is a Hamster and I think Avalanche is a turtle.
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 02-03-2005 , 00:05  
Reply With Quote #5

This format is used with only one line :
Code:
case x : statement
This format is used with more than one line :
Code:
case x : {    statements }
Do you understand now? The { } braces are used when you are using more than one statement , you don't need one if you are only using one statement.
Peli is offline
Send a message via MSN to Peli
Votorx
Senior Member
Join Date: Jun 2004
Old 02-03-2005 , 07:19  
Reply With Quote #6

Yeah that's what I thought but everytime I try that I keep getting errors whenever I compile. Can't tell you what it is right now though becuase im at school.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode