Question If Or And???

# Thread: Question If Or And???

1. Senior Member
Join Date
Dec 1969
Posts
508

## Question If Or And???

Hi, i am wondering how this if statement will be handled, it is kind of difficult to test it.<BR><BR>If Cint(ResponseValues(8)) = 1 Or Cint(ResponseValues(15)) = 1 Or Cint(ResponseValues(14)) &#062;-1 And Cint(ResponseValues(14)) &#060;= 6 Or Cint(ResponseValues(21)) &#062;-1 And Cint(ResponseValues(21)) &#060;= 6 Then<BR><BR>what i want is If 8 = 1 or 15 = 1 or 14 greater than -1 and 14 less than or equal 6 or 21 greater than -1 and 14 less than or equal 6 than do something else do something else, i think i need to put () around each statement.

2. Senior Member
Join Date
Dec 1969
Posts
508

## I think

I beleive i have it

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## Use arithmetic...

...or algebra.<BR><BR>Think of OR as being the same as + (add)<BR>Think of AND as being the same as * (multiply)<BR><BR>So think of your "IF" clause like this:<BR> a OR b OR c AND d OR e AND f<BR><BR>Now replace the OR with + and the AND with *<BR> a + b + c * d + e * f<BR><BR>And hopefully you know that, by the rules of arithmetic and algebra, all the multiplies are done before any additions, so that&#039;s the same as<BR> a + b + ( c * d ) + ( e * f )<BR><BR>Or, going back to the AND OR form:<BR> a OR b OR ( c AND d ) OR ( e AND f )<BR><BR>And if that isn&#039;t the grouping that you mean, then add parens *APPROPRIATELY* to change it. There is a *VAST* difference between (for example)<BR> a OR b OR ( c AND d ) OR ( e AND f )<BR>and<BR> (a OR b OR c) AND (d OR e) AND f<BR><BR><BR><BR><BR>

4. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## BODMAS <eop>

.

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## Well, (DM)(AS)...

Since D and M are just done left to right, equal priority, as are A and S.<BR><BR>But what the heck is BO?<BR><BR>Other than what there is a lot of around here?<BR><BR>

6. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## B = Brackets

o = Order<BR><BR><BR>hmmmm<BR><BR><BR>lets see what google gives us<BR><BR><BR>http://www.easymaths.com/What_on_earth_is_Bodmas.htm<BR><BR><BR>

7. Senior Member
Join Date
Dec 1969
Posts
11,334

## B is brackets, I think

Or meaning parenthesis.<BR><BR>Dunno about the O. Outside? doesn&#039;t make sense, but...

8. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Oh you Americans

Did they not teach you that in school??<BR><BR><BR>Jeez<BR><BR>

9. Senior Member
Join Date
Dec 1969
Posts
11,334

## Maybe. I only remember FOIL

from Algebra.

10. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## FOIL?? <eop>

.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•