|
I think what you are missing is that *and and *or are conditions. The *and merely separates expressions, yet is like a stepping stone to the next step. If A and B and (C and D), there is no reason to care what (C and D) equals unless (A and B) is true. -Tracy Ext. 3107 -----Original Message----- From: Dan [mailto:dbcerpg@xxxxxxxxx] Sent: Thursday, March 20, 2003 3:35 PM To: RPG programming on the AS400 / iSeries Subject: Re: Operation Precedence questions --- Douglas Handy <dhandy1@xxxxxxxxxxxxx> wrote: > Dan, > > >What if your example were thus: > > A AND B AND X < 10 > > That becomes the equivalent of > > A and B and ( X < 10 ) > > Thus we are now reduced to only have AND clauses, which are short-circuit > evalutated from left to right. So unless both A and B are true, it never has > to > evaluate ( X < 10 ). > > See? > > Doug Unfortunately, no, I don't. As I see it, the parentheses surrounding X < 10 *guarantees* that it will be evaluated before the ANDs are tested. Again, pointing to the Precedence of Operations: The following list indicates the precedence of operations from highest to lowest: 1. () 2. Built-in functions, user-defined functions 3. unary +, unary -, NOT 4. ** 5. *, / 6. binary +, binary - 7. =, <>, >, >=, <, <= 8. AND 9. OR Based on how everyone has responded to me thus far, it seems the precedence of operations should be: 1. AND 2. OR 3. () 4. Built-in functions, user-defined functions 5. unary +, unary -, NOT 6. ** 7. *, / 8. binary +, binary - 9. =, <>, >, >=, <, <= Again, what am I missing? __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.