Raised This Month: $ Target: $400
 0% 

if elseif else?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vip-colgate
Junior Member
Join Date: Jan 2010
Location: Game World
Old 05-26-2013 , 23:10   Re: if elseif else?
Reply With Quote #1

Are you sure?
Code:
if( one ) { ...; return; }
if( two ) { ...; return; }
...
__________________
vip-colgate is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-26-2013 , 23:19   Re: if elseif else?
Reply With Quote #2

Quote:
Originally Posted by vip-colgate View Post
Are you sure?
Code:
if( one ) { ...; return; }
if( two ) { ...; return; }
...

Yes.
ddhoward is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 05-26-2013 , 23:54   Re: if elseif else?
Reply With Quote #3

Quote:
Originally Posted by vip-colgate View Post
Are you sure?
Code:
if( one ) { ...; return; }
if( two ) { ...; return; }
...
if your returning a value after the first IF then the others wont be checked.

but if your if check has more then 2 else if you should use a switch its better.

if( bla ){
...
}
else {
......
}

is ok for checking one or two things.
__________________
Blizzard_87 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:18.


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