correct use of OR statement - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: correct use of OR statement (/Thread-correct-use-of-OR-statement) |
correct use of OR statement - lotos - 06-02-2011 Hi guys, I have a situation where I am trying to use the OR statement. And when I'm running the test, I observed that this statement is ignored (or it's not used in the right way). See the code bellow: Code: 'querying a 'SELECT' event within DB In my case I have the MyCheck = 8, and it is ignoring the first condition and checking it's conditions, but should go to the 3rd condition (Else If MyCheck = 8 Then) I've tried next ways: IF MyCheck = 1 or 0 or 9 Then IF MyCheck = 1 or MyCheck = 0 or MyCheck = 9 Then Can please anyone help me with right use of OR?! RE: correct use of OR statement - sundari.msls - 06-02-2011 I think the below logic works for you. Usually when your are using the same variable mutliple times in a condition, you should use AND. See the code below: Code: MyCheck =8 RE: correct use of OR statement - lotos - 06-02-2011 Hi sundari, thanks, but as I know the AND statement when it's used, means that all the conditions are true?! so in this case doesn't AND means that MyCheck <> 8, 1, 9, and 0?! |