AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Question operators "&&" / "||" (https://forums.alliedmods.net/showthread.php?t=252839)

ghost95v 12-10-2014 05:48

Question operators "&&" / "||"
 
hello, well as title says, what this " && " operator exactly does, and what this else do " || ", whats the difference betwen them. i use them always , but i dont know whats the diffrence betwen them :D.... Thank you :)

ZASTRELIS 12-10-2014 05:51

Re: Question operators "&&" / "||"
 
&& AND
|| OR

http://www.learncpp.com/cpp-tutorial...cal-operators/

HamletEagle 12-10-2014 08:48

Re: Question operators "&&" / "||"
 
&& means "and" and is a logical operator:
Code:

TRUE && TRUE = TRUE
FALSE && FALSE = FALSE
TRUE && FALSE = FALSE
FALSE && TRUE = FALSE

|| means "or" and is a logical operator:
Code:

TRUE || TRUE = TRUE
FALSE || FALSE = FALSE
TRUE || FALSE = TRUE
FALSE || TRUE = TRUE

Also we have "&" which is for bits and check if a given bit is contained in a sum of bits.

jimaway 12-10-2014 10:00

Re: Question operators "&&" / "||"
 
Quote:

Originally Posted by HamletEagle (Post 2233369)
Also we have "&" which is for bits and check if a given bit is contained in a sum of bits.

& is actually bitwise AND operator and it multiplies every bit and returns the answer

example:
Code:

1100
&0101
=0100
(1*0=0; 1*1=1; 0*0=0; 0*1=0)



All times are GMT -4. The time now is 15:30.

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