|
Well, I'm certainly glad this has opened up such a broad discussion. I've learned a lot from the comments and I'm going to switch my logic to test the pos of the index first. Incase those of you who were wondering InputMAD refers to a mailing address of which certain pieces need to be verified. The mailing address field comes in the following format: 123 Easy St Apt. 3;Anytown, NY 11700;c/o John Doe Thanks again, Ted >>> boldt@xxxxxxxxxx 03/25/04 11:02AM >>> Gerald Magnuson wrote: > Hans, > Are you saying it makes a difference > if we have the "and" on the top line, > or on the next line? > Could you explain why that is? > I believe someone else already answered this. But just to reiterate and clarify, the following three statements are equivalent: #1: dow pos < 52 and (InputMAD(pos) <> ';'); #2: dow pos < 52 and (InputMAD(pos) <> ';'); #3: dow pos < 52 and (InputMAD(pos) <> ';'); The compiler doesn't care how many lines are used to code an expression. It just boils down to personal preferences or site specific programming style conventions. But they're not the same as: dow (InputMAD(pos) <> ';') and pos < 52; That is, order matters within a relational expression. For example, if the first argument of the AND operator is false, there's no point in evaluating the second argument. Likewise, if the first argument of the OR operator is true, there's no point in evaluating the second. That's why you test the array index before using it the reference an array element. Cheers! Hans _______________________________________________ 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.