|
Personally, I use the following: My basic rule of thumb is for all code grouping functions (IF, DOW, DOW, FOR, etc), to indent the conditional/loop code so that it lines up with the condition specs (IF=3, DOW=4, FOR=4, etc). DOW Not %EOF(FileName); DoFieldStuff(); EndDo; If A=B; DoStuff(); Else; DoOtherStuff(); EndIf; For a SELECT clause, this is a bit much, so I indent the WHEN by 2, and indent the code for the WHEN by another 2: Select; When X=1; DoXStuff(); When X=2; Do X2Stuff(); EndSL; I also have a few basic rules on line spacing. I will add a line space after ENDxx ops. If DoneIndy; Return; EndIf; DoMoreStuff(); The exception to this is nested ENDxx ops -- I don't add an extra line space If DoneIndy; If FilesOpen; CloseFiles(); EndIf; Return; EndIf; I have become accustomed to this style, and it seems to be the most readable (for me anyways). I also have my own guidelines for upper/lower case, but you can probably see that in my examples. On 7/27/05, RPower@xxxxxxxxxx <RPower@xxxxxxxxxx> wrote: > > Does anyone have any Proper indentation guidelines for FreeFormat coding? > Such as If statements, Select statements etc? I know it's personal > preference, but would like some ideas to help set a style. > > Ron Power > Programmer > Information Services > City Of St. John's, NL > P.O. Box 908 > St. John's, NL > A1C 5M2 > 709-576-8132 > rpower@xxxxxxxxxx > http://www.stjohns.ca/ > > ___________________________________________________________________________ > Success is going from failure to failure without a loss of enthusiasm. - > Sir Winston Churchill > -- > 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.