Subj : Re: Syntax, style, the infinite monkey theorum and coding To : comp.programming From : Gerry Quinn Date : Tue Aug 23 2005 12:25 pm In article , m.fee@iirrll..ccrrii..nnzz says... > In article , gerryq@DELETETHISindigo.ie says... > > In article <1124699428.796351.185650@g14g2000cwa.googlegroups.com>, > > I can imagine that being a viable style in some cases, i.e. where there > > are several independent conditions that break the loop and each needs a > > comment: > > > > while( condition1 // comment > > && condition2 // comment > > && condition3 // comment > > ) > > { > > // do stuff > > } > My preferred style would be something like... > > function Peculiar_Conditions(some arguements) : boolean; > begin > result := condition1 //comment > and condition2 //comment > and condition3; //comment > end; > > ... > > while Peculiar_Conditions(some arguements) do > begin > do stuff > end; > > Thus separating out the conditional logic from the rest of the program flow. PeculiarConditions() is an option, particularly if they really have some particular meaning, i.e. something that is simply stated but needs a lot of testing to find out. I prefer the style: while( true ) { if ( ! condition1 ) break; if ( ! condition2 ) break; // do stuff } But not everyone likes that either. - Gerry Quinn .