| View previous topic :: View next topic |
| Author |
Message |
kadamat
Joined: 01 Jun 2006 Posts: 88
|
LOL. *whistling sound of bomb dropping* can anyone tell me how to handle a situation where one might want to have multiple options or cases in a logical statement>? If else type stuff.
I have more than two cases though |
| |
|
|
|
|
Koplaf
Joined: 28 May 2006 Posts: 130
|
| Use the boolean AND/OR statements |
| |
|
|
ovigo22
Joined: 15 May 2006 Posts: 130
|
If (condition) { action } else if (condition) { action } else { action }
Ahh .. stuff like that .. |
| |
|
|
Mupolan
Joined: 30 May 2006 Posts: 101
|
| Or switch |
| |
|
|
ovigo22
Joined: 15 May 2006 Posts: 130
|
| If ( this || orthis ) { action } else if ( this && andthis ) { action } |
| |
|
|
Roombor
Joined: 02 Jun 2006 Posts: 111
|
| Sounds perfect for switch |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| kadamat: er... switch/case ? |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| So, could it be if (condition) { action } else if (condition) { action } else { action } -------------and then an infinite number of continued else { action } else { action } else { action } ? |
| |
|
|
ovigo22
Joined: 15 May 2006 Posts: 130
|
Yeah .. switch if the LHS of the comparison is always the same
kadamat, no, only one will ever get called |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| So switch is better for this? |
| |
|
|
| Page 1 of 3 |
Goto page 1, 2, 3 Next |
|