<p>What is the operator precedence order in Visual Basic 6.0 (VB6)?</p>

<p>In particular, for the logical operators.</p>

[{'answer_id': 55215, 'author': 'Jeremy', 'author_id': 1114, 'author_profile': 'https://Stackoverflow.com/users/1114', 'pm_score': 5, 'selected': True, 'text': '<h3>Arithmetic Operation Precedence Order</h3>\n<ol>\n<li><code>^</code></li>\n<li><code>-</code> (unary negation)</li>\n<li><code>*</code>, <code>/</code></li>\n<li><code>\\</code></li>\n<li><code>Mod</code></li>\n<li><code>+</code>, <code>-</code> (binary addition/subtraction)</li>\n<li><code>&amp;</code></li>\n</ol>\n<h3>Comparison Operation Precedence Order</h3>\n<ol>\n<li><code>=</code></li>\n<li><code>&lt;&gt;</code></li>\n<li><code>&lt;</code></li>\n<li><code>&gt;</code></li>\n<li><code>&lt;=</code></li>\n<li><code>&gt;=</code></li>\n<li><code>Like</code>, <code>Is</code></li>\n</ol>\n<h3>Logical Operation Precedence Order</h3>\n<ol>\n<li><code>Not</code></li>\n<li><code>And</code></li>\n<li><code>Or</code></li>\n<li><code>Xor</code></li>\n<li><code>Eqv</code></li>\n<li><code>Imp</code></li>\n</ol>\n<p><strong>Source:</strong> <a href="http://www.informit.com/library/content.aspx?b=STY_VB6_24hours&amp;seqNum=247" rel="noreferrer">Sams Teach Yourself Visual Basic 6 in 24 Hours — Appendix A: Operator Precedence</a></p>\n'}, {'answer_id': 55260, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 3, 'selected': False, 'text': "<p>It depends on whether or not you're in the debugger. <em>Really.</em>  Well, sort of.</p>\n\n<p>Parentheses come first, of course. Then arithmateic (+,-,*,/, etc). Then comparisons (>, &lt;, =, etc). Then the logical operators. The trick is the order of execution within a given precedence level is not defined. Given the following expression:</p>\n\n<pre><code>If A &lt; B And B &lt; C Then\n</code></pre>\n\n<p>you are guaranteed the <code>&lt;</code> inequality operators will both be evaluated before the logical <code>And</code> comparison. But you are not guaranteed which inequality comparison will be executed first.  </p>\n\n<p><strong>IIRC, the debugger executes left to right, but the compiled application executes right to left.</strong>  I could have them backwards (it's been a long time), but the important thing is they're different. The actual precedence doesn't change, but the order of execution might.</p>\n"}, {'answer_id': 615404, 'author': 'MarkJ', 'author_id': 15639, 'author_profile': 'https://Stackoverflow.com/users/15639', 'pm_score': 2, 'selected': False, 'text': '<h1><strong>Use parentheses</strong></h1>\n\n<hr>\n\n<p>EDIT: That\'s my advice for new code!  But Oscar is reading someone else\'s code, so must figure it out somehow. I suggest the VBA manual topic <a href="https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/operator-precedence" rel="nofollow noreferrer"><em>Operator Precedence</em></a>. VBA is 99% equivalent to VB6 - and expression evaluation is 100% equivalent. I have pasted the logical operator information here. </p>\n\n<p>Logical operators are evaluated in the following order of precedence:</p>\n\n<pre>Not   \nAnd   \nOr   \nXor   \nEqv   \nImp   \n</pre>\n\n<p>The topic also explains precedence for comparison and arithmetic operators.  </p>\n\n<p>I would suggest once you have figured out the precendence, you put in parentheses unless there is some good reason not to edit the code.</p>\n'}]
['https://Stackoverflow.com/questions/55206', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5472/']