Switch/Case statements

Started by Alynn, Fri 14/11/2003 14:36:04

Previous topic - Next topic

Alynn

You think maybe you could place this in here... so many if statements gets on my nerves...

(using psudocode)
Code: ags
switch (inventory_Number){
    case 1: {Witty remark}
    case 2: {Smartass remark}
    case 3: {Correct item do stuff}
    case 4: {Make fun of the player for thinking that}
    case 5: {Kill the player (never use a fork on an electrical outlet)
    default: {Throw random gibberish on the screen}
}


So much nicer IMO... many if statements work the same, just not as easy to maintain... (would be nice if it would work for strings also)

scotch

It's been asked for a few times, I'd like it as there are many places in my code it would save large amounts of space, but you can always do it with if statements so CJ seems to want to work on other things instead, which is fine by me.

Pumaman

Yeah, it's a low priority feature since you can do it with "else if"s instead, but it would be nice, I agree.

SMF spam blocked by CleanTalk