Raised This Month: $ Target: $400
 0% 

Question operators "&&" / "||"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 12-10-2014 , 05:48   Question operators "&&" / "||"
Reply With Quote #1

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 .... Thank you
__________________

Last edited by ghost95v; 12-10-2014 at 05:50.
ghost95v is offline
Send a message via Skype™ to ghost95v
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 12-10-2014 , 05:51   Re: Question operators "&&" / "||"
Reply With Quote #2

&& AND
|| OR

http://www.learncpp.com/cpp-tutorial...cal-operators/
ZASTRELIS is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-10-2014 , 08:48   Re: Question operators "&&" / "||"
Reply With Quote #3

&& 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.
__________________
HamletEagle is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 12-10-2014 , 10:00   Re: Question operators "&&" / "||"
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
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)
jimaway 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 15:30.


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