AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Switch and Case (https://forums.alliedmods.net/showthread.php?t=9883)

Votorx 02-02-2005 13:12

Switch and Case
 
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?

PM 02-02-2005 14:54

I think I've been using this:

Code:
switch (x) { case 1:    Yams case 2:    Turtle case 3:    {       OLOLOL!       OMGOMGOMG!    } }

Da Bishop 02-02-2005 22:45

wow... that was very helpful pm LOLZ :P

TotalNoobScripter 02-02-2005 23:51

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.

Peli 02-03-2005 00:05

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.

Votorx 02-03-2005 07:19

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.


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

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