else if

Non-platform specific questions.

else if

Postby Fojam » Sun Apr 29, 2012 8:49 pm

when i write an else if statement, is it written:
Code: Select all
else if(var1>var2)
{
    //action
}


or is it written:

Code: Select all
else
{
    if(var1>var2)
    {
        //action
    }
}
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: else if

Postby skydereign » Sun Apr 29, 2012 8:51 pm

The first way.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: else if

Postby Fojam » Sun Apr 29, 2012 9:15 pm

ok thanks
CLICK TO GIVE ME POINTS

My Latest Projects:
Super Smash Bros: viewtopic.php?f=6&t=12307 PLEASE help by making sprites!
User avatar
Fojam
 
Posts: 513
Joined: Thu Mar 19, 2009 10:02 pm
Location: under your bed!!!
Score: 69 Give a positive score

Re: else if

Postby SuperSonic » Mon Apr 30, 2012 1:23 am

Honestly, both ways work, but the first one is more efficient :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest