AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if(... and ...) ??? (https://forums.alliedmods.net/showthread.php?t=12588)

Bone 04-18-2005 20:24

if(... and ...) ???
 
I want to know how you do something like

Code:
if (bob = 1 and jim = 2)

I dont think you put and in between them thou do you?

Twilight Suzuka 04-18-2005 20:27

&&

BioHazardousWaste 04-18-2005 20:36

i think you need a double equals sign dont' you? or is that just java and c++?

if (bob == 1 && jim ==2)
{
stuff
}
else
{
more stuff
}

Bone 04-18-2005 20:41

thanks, i always ut == i dont know if its needed thou

v3x 04-19-2005 11:40

This is the way I look at it.

--
Code:
if(bob == jim) { ... }
If bob IS EQUAL TO jim.
--
Code:
if(bob != jim) { ... }
If bob is NOT EQUAL TO jim.
--
Code:
if(bob != jim || jim != joe) { ... }
If bob is NOT EQUAL TO jim OR jim is NOT EQUAL TO joe.
--
Code:
if(bob == jim && jim != joe) { ... }
If bob is EQUAL TO jim AND jim is NOT EQUAL TO joe.
--
Code:
if(bob <= jim) { ... }
If bob is LESS THAN OR EQUAL TO jim
--
Code:
if(bob >= jim) { ... }
If bob is GREATER THAN OR EQUAL TO jim
--

Hope that helps..

Bone 04-19-2005 15:24

yeah quite a bit actually :-D thanks

v3x 04-19-2005 18:51

Oh, and for this:
Code:
if(bob == 1) { ... } if(bob == 0) { ... }
You could just do:
Code:
if(bob) { ... } if(!bob) { ... }
:D

Btw, I edited my above post a wee bit..


All times are GMT -4. The time now is 09:51.

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