| View previous topic :: View next topic |
| Author |
Message |
ovigo22 Enthusiastic Coder
Joined: 15 May 2006 Posts: 130
| |
kadamat Enthusiastic Coder
Joined: 01 Jun 2006 Posts: 88
|
Cool... but it seems like extra keystrokes for a single situation
Reply with quote
|
| |
|
|
ovigo22 Enthusiastic Coder
Joined: 15 May 2006 Posts: 130
|
Not necesarily .. switch is good for: if (X =1 ) { action } else if (X = 2) { action } else if (X = 3) {action} else {action} where the LHS of the condition is always the same
(think about multiple 'else' clasuses .. when would any but the first get executed?
Reply with quote
|
| |
|
|
kadamat Enthusiastic Coder
Joined: 01 Jun 2006 Posts: 88
| |
AmeliaR Enthusiastic Coder
Joined: 31 May 2006 Posts: 142
|
ovigo22, heh, well not to get offtrack, but for that I think a for loop would be better :-P
Reply with quote
|
| |
|
|
ovigo22 Enthusiastic Coder
Joined: 15 May 2006 Posts: 130
| |
kadamat Enthusiastic Coder
Joined: 01 Jun 2006 Posts: 88
|
Well, basically, I have a dropdown menu with four options. I need to set up a statement to handle all four. which would be the coolest/most elegant way to approach this?
Reply with quote
|
| |
|
|
ovigo22 Enthusiastic Coder
Joined: 15 May 2006 Posts: 130
|
kadamat,switch would be as the LHS will always be the selectedIndex ..
(object full of functions == perl)
Reply with quote
|
| |
|
|
Gladis Enthusiastic Coder
Joined: 24 May 2006 Posts: 107
| |
kadamat Enthusiastic Coder
Joined: 01 Jun 2006 Posts: 88
| |
|