Raised This Month: $ Target: $400
 0% 

If Else, If Else


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-12-2009 , 06:58   If Else, If Else
Reply With Quote #1

Does pawn support if else, if else statements? My main programming language is JavaScript and I use a lot of if else, if else statements.

Also, if pawn does support them, is it the same way in JavaScript?
BOYSplayCS is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 03-12-2009 , 07:08   Re: If Else, If Else
Reply With Quote #2

Yes, Pawn supports conditional statements. -_-
Spunky is offline
Send a message via AIM to Spunky
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-12-2009 , 07:10   Re: If Else, If Else
Reply With Quote #3

Well the thing is, I tried it my own way and it compiled with a ton of errors. I'm looking for a fix currently, hold tight and I'll post my script.
BOYSplayCS is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 03-12-2009 , 07:30   Re: If Else, If Else
Reply With Quote #4

Code:
if(condition = 1)
{
    //Do this
}
else if(condition = 2)
{
    //Do this
}
else
{
    //Do this
}
__________________
minimiller is offline
Send a message via MSN to minimiller
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 03-12-2009 , 07:47   Re: If Else, If Else
Reply With Quote #5

= is the assignment operator mini... == is the equal to conditional operator.
Spunky is offline
Send a message via AIM to Spunky
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-12-2009 , 08:14   Re: If Else, If Else
Reply With Quote #6

I just searched my scripting folder for "else if" and I got over 500 hits, I guess it must work . I am assuming you are asking that (if, else if, else).
__________________

Last edited by fysiks; 03-12-2009 at 08:17.
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-12-2009 , 08:42   Re: If Else, If Else
Reply With Quote #7

You may be interested in switch statement : http://wiki.amxmodx.org/Optimizing_P..._instead_of_If
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-12-2009 , 08:54   Re: If Else, If Else
Reply With Quote #8

In Pawn, I regularly do use the switch() statements, but I was just wondering with the if else, if else.
BOYSplayCS is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 03-12-2009 , 09:05   Re: If Else, If Else
Reply With Quote #9

btw, what does "else if" do? why not just if, if then else?
Owyn is offline
Send a message via ICQ to Owyn
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 03-12-2009 , 09:33   Re: If Else, If Else
Reply With Quote #10

Quote:
Originally Posted by .Owyn. View Post
btw, what does "else if" do? why not just if, if then else?
PHP Code:
// Example 1: y will be executed everytime
if( something // x
if( somethingelse // y

// Exampe 2: y will be executed only "something" is false
if( something // x
else if( somethingelse // y 
__________________

anakin_cstrike 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 08:57.


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