Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using CFScript statements

Explorer ,
Jun 18, 2012 Jun 18, 2012
TOPICS
Documentation
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 18, 2012 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 06, 2012 Oct 06, 2012
LATEST

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)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 21, 2012 Jun 21, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources