|
This isn't the most important question of our times, but I just wondered what everyone else thought. If I need to define more than one array, each array with the same number of elements, I typically do this: D cCMLimit C 20 D CM# S 7 0 Dim(cCMLimit) D IN# S 7 0 Dim(cCMLimit) D AMT S 7 2 Dim(cCMLimit) Then, later in my code, I always use the constant I created, like this: For X = 1 To cCMLimit; <do something> Endfor; Or this: If X <= cCMLimit; <do something> Else; <do something else> Endif; It suddenly occurred to me that even though I used a constant to define the size of the array, in the code I should still use %Elem like this: For X = 1 To %Elem(CM#); <do something> Endfor; Because this makes it immediately apparent to any other programmer (or me 6 months down the road) that I'm traversing the entire array, whereas using a constant doesn't imply that. What do you think? Enquiring minds want to know . . .
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.