|
||
|
|
#2 (permalink) | |
|
RunUO Forum Moderator
|
Quote:
__________________
I always try to help
![]() Sometimes, I don't know how.... ![]() My Web Page Forum Rules ------------------------------------------------------------- Extensive OWLTR System | Token System | World Teleporters ------------------------------------------------------------- |
|
|
|
|
|
|
#5 (permalink) | |
|
Forum Expert
Join Date: Oct 2004
Location: Chesterton, IN
Age: 29
Posts: 288
|
Quote:
Code:
if (x == y || x == z) |
|
|
|
|
|
|
#6 (permalink) | |
|
Account Terminated
|
Quote:
![]() |
|
|
|
|
|
|
#12 (permalink) |
|
Forum Newbie
Join Date: Jun 2005
Age: 31
Posts: 45
|
(x == y || x == z) is wrong.
x == (y || z) .... when x ==0 and y ==1 and z==0 0 == (1||0) .... = (0==1) = 0. so it gives false but when its (x == y || x == z) (0 == 1 || 0==0) ....... (0 || 1) = 1 So these two are not equal in case if x=0 and y=1 and z=0 or case x=0 and y=0 and x=1 (other cases are ok ) |
|
|
|
|
|
#13 (permalink) | |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 27
Posts: 4,818
|
Quote:
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
|
|
#14 (permalink) | |
|
Forum Expert
|
Quote:
Code:
x == y || x == z Now, back to the topic, you can doing something like Code:
x == (y || z) Code:
class TestClass
{
public TestClass ( int i1, int i2 )
{
x = i1;
y = i2;
}
public static bool operator == ( int i, TestClass tc )
{
return (i == tc.x || i == tc.y);
}
public static bool operator != ( int i, TestClass tc )
{
return !(i == tc);
}
int x
, y;
}
class TestClass2
{
public TestClass2 ( int i )
{
x = i;
}
public static TestClass operator | ( TestClass2 tc1, TestClass2 tc2 )
{
return new TestClass( tc1.x, tc2.x );
}
public int x;
}
Code:
int i = 20;
TestClass2 tc1 = new TestClass2(10)
, tc2 = new TestClass2(20);
i == (tc1 | tc2);
Code:
i == tc1.x || i == tc2.x However, do note that I love that you can do this. Last edited by Sep102; 05-04-2006 at 11:03 PM. |
|
|
|
|
|
|
#15 (permalink) | |
|
Moderate
Join Date: Nov 2002
Location: USA
Posts: 6,598
|
Quote:
__________________
David Forum Moderator The RunUO.com Forum Moderator Team Forum Rules and Guidelines RunUO Forum Search Engine Download RunUO 2.0 RC2 |
|
|
|
|
|
|
#17 (permalink) | |
|
Account Terminated
|
Quote:
What he wants is if x is equal to y or z, then the statement would be true, which is what has been posted. |
|
|
|
|
|
|
#18 (permalink) | |
|
Account Terminated
Join Date: Sep 2002
Location: New York
Age: 22
Posts: 476
|
Quote:
This shouldn't have gone past daat99's reply. |
|
|
|
|
|
|
#19 (permalink) | |
|
Account Terminated
|
Quote:
Now that I know, I wish I didn't because its a lame reason ![]() |
|
|
|
|
|
|
#20 (permalink) | |
|
Forum Newbie
Join Date: Jun 2005
Age: 31
Posts: 45
|
Quote:
(0 == 1 || 0==0) ....... (0 || 1) = 1 then think again, becouse you are wrong. 0==1 gives 0 0==0 gives 1 therefore i've written that its equal to (0 || 1) = 1 = true Result is the same as you say, but looks like you think something different. |
|
|
|
|
|
|
#21 (permalink) |
|
Account Terminated
|
I don't understand what your saying about what I said is incorrect.
You said the following: 0 == (1||0) .... = (0==1) = 0. so it gives false Looking at it again, I see thats actually is infact true, you do understand that || stands for OR correct? If the OR statement was an bit-wsie OR statement then it would be false. But its not and 0==0 is a true statement. |
|
|
|
|
|
#22 (permalink) |
|
Forum Expert
|
Perhaps this would clarify his statement a bit better
We have: Code:
false == (true || false); Code:
(true || false) = true Code:
false == (true || false) = false == true = false |
|
|
|
|
|
#24 (permalink) | |
|
Account Terminated
|
Quote:
I am still going to say your incorrect for saying its false. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |