ANSWERS: 8
  • Try to include the word EITHER in there. IF A = true AND EITHER B = true OR C = true OR D = true THEN... Without knowledge of what language you are using it is hard to give better advice.
  • You haven't specified the language, so here's pseudocode: a=1 b=2 c=3 d=4 if (a==1) then if (b==2 OR c==3 OR d==4) then // success
  • Pseudocode: if a and (b or c or d):    something Java: if(a && (b || c || d)){    something; }
  • If (A and (B or C or D)) Then
    • mushroom
      This is the most straightforward answer, given the question. The parenthesis group (B or C or D) together, so that "A" AND one or more of (B or C or D) must be true.
  • Slothmeister is correct. It's hard to know which language you want to use. They all have their own syntax. You might have to do something where you test for the optional subset first and give that result a value. For example, if you need true values for A and either X, Y, or Z then you would do a test something like the following where 1 is true and 0 is false. IF X or Y or Z THEN set B = 1; IF A = 1 AND B = 1
  • As everybody else says, it's difficult without knowing what language. However, just in case it's as mundane as a spreadsheet this works in Excel: =IF(OR(E7=E8,E7=E9,E7=E10),"Yes","No")
  • Well if you doing ASP language then here: <% If A = "" OR B = "" OR C = "" OR D = "" Then Else End If %>
  • Most languages support a Case statement of some kind. When there are three or more conditions a case statement is tidier and easier to use and debug than a multiply embedded "If" statement. So in your example Case Result of A := Action1; A and B := Action2; A and C := Action3; A and D := Action4; endcase;

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy