"else if" or "if"
#5

Get rid of "else if" wherever possible. You should never need to use that construct. If you keep the rule in mind that "else should alway be on its own" then you will have far less problems.
PHP код:
if
{
    
// 1
}
else if
{
    
// 2
}
else
{
    
// 3

Can and should be restructured like:
PHP код:
if
{
    
// 1
}
else
{
    if
    {
        
// 2
    
}
    else
    {
        
// 3
    
}

And then you'll notice what a horrible mess the code really is.
Reply


Messages In This Thread
"else if" or "if" - by Mouiz - 09.07.2015, 18:28
Re: "else if" or "if" - by Sime30 - 09.07.2015, 18:31
Re: "else if" or "if" - by Mouiz - 09.07.2015, 18:37
Re: "else if" or "if" - by DTV - 09.07.2015, 19:09
Re: "else if" or "if" - by Vince - 09.07.2015, 19:19

Forum Jump:


Users browsing this thread: 1 Guest(s)