TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: Randy Birch
date: 2004-06-05 11:51:00
subject: Re: the OR operator

The results can be different, so OR and + are not truly interchangeable. 
Consider:

x=1
y=3
z1 = x Or y
z2 = x + y

? z1, z2
> 3        4

OR (and AND) are logical operators which in conjunction with grouping 
parentheses, can be used to build sophisticated logical expressions.  On 
numeric values OR performs what is called a "bitwise disjunction"
on the two 
numeric values.  This makes it handy for comparisons such as:

w=5
x=1
y=3

if (x or w) < (y or w) then...

as:

Debug.Print (x Or w) < (y Or w),
Debug.Print (x + w) < (y + w)

Debug.Print (x Or w), (y Or w)
Debug.Print (x + w), (y + w)

> True    True
    5             7
    6             8





-- 

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.


"Dan."  wrote in message
news:c9sl7j$elp$1{at}news.tiscali.fr...
: hi, i'm sorry to bother you; but i was wondering what the function of the 
OR
: operator was in terms of numbers:
:
:     num0 = num1 or num2
:
: i wrote me a little thing to try and see the effects and if the numbers 
are
: close, they add up; if they're real far apart, it gives the bigest only, 
and
: sometimes it gives the biggest +1 or +2.
:
: could someome please confirm the effects.
: thanks in advance
:     Dan.
:
:
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 6/5/04 11:51:24 AM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.