Skip to main content
This topic has been closed for replies.

2 replies

Participating Frequently
June 21, 2012

For the last code, an opening angle bracket (<) is missing in the opening cfscript tag.

p_sim
Participating Frequently
June 18, 2012

The code example loops through a query that uses do-while() is a poor example. It should utilize while(). We want to check first if there is a result set. If there is, then read the record. Using while() would eliminate the use of if() statement prior do-while(). do-while() means we want to run the first loop, then check a condition whether or not to run the subsequent loop. while() means we want to check if the first and subsequent loop is true.

Charlie Arehart
Community Expert
Community Expert
October 7, 2012

More than that, the example (showing a do-while to loop over a query) can be removed as of CF10 with its new support for for-in looping over a query (shown near the bottom of this page). As there are other examples of do-while loops offered above it, there's really no need even to replace it with something else.

/Charlie (troubleshooter, carehart. org)