redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers
Tuesday 23 July 2019 14:11

Ask your IT question here

how to handle a situation with multiple cases


Goto page 1, 2, 3  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Programming Forums -> JavaScript forum
View previous topic :: View next topic  
Author Message
kadamat
Enthusiastic Coder


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

Reply with quote
 
Koplaf
Enthusiastic Coder


Joined: 28 May 2006
Posts: 130
Use the boolean AND/OR statements
Reply with quote
 
ovigo22
Enthusiastic Coder


Joined: 15 May 2006
Posts: 130
If (condition) { action } else if (condition) { action } else { action }
Ahh .. stuff like that ..

Reply with quote
 
Mupolan
Enthusiastic Coder


Joined: 30 May 2006
Posts: 101
Or switch
Reply with quote
 
ovigo22
Enthusiastic Coder


Joined: 15 May 2006
Posts: 130
If ( this || orthis ) { action } else if ( this && andthis ) { action }
Reply with quote
 
Roombor
Enthusiastic Coder


Joined: 02 Jun 2006
Posts: 111
Sounds perfect for switch
Reply with quote
 
AmeliaR
Enthusiastic Coder


Joined: 31 May 2006
Posts: 142
kadamat: er... switch/case ?
Reply with quote
 
kadamat
Enthusiastic Coder


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 } ?
Reply with quote
 
ovigo22
Enthusiastic Coder


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

Reply with quote
 
kadamat
Enthusiastic Coder


Joined: 01 Jun 2006
Posts: 88
So switch is better for this?
Reply with quote
 
Page 1 of 3 Goto page 1, 2, 3  Next
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Programming Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Forum | Java Programming | 3d Design Resources | 3d Forum | 3D Jobs | 3D Textures | Paris Forum | Europe Forum
Dubai Classifieds | Dubai Property | Jobs in Dubai | Free London Classifieds | Jobs in London UK

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

© 2018 RedHo