Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
701 views
in Technique[技术] by (71.8m points)

asp classic - (Number and Number) in VBscript

I have some VB script in classic ASP that looks like this:

if (x and y) > 0 then
    'do something
end if

It seems to work like this: (46 and 1) = 0 and (47 and 1) = 1

I don't understand how that works. Can someone explain that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It's a Bitwise AND.

    47 is 101111
AND  1 is 000001
        = 000001

while

    46 is 101110
AND  1 is 000001
        = 000000

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...