do Loop
From NWN Lexicon
Revision as of 22:55, 22 August 2015 by Squatting Monk (talk | contribs) (Prettified article formatting.)
The statements within a do code block are executed and then the condition of the loop is evaluated. This ensures that the statements will execute at least once. If the condition evaluates to FALSE the loop will halt.
// prototype
// do { statement; } while (expression);
// actual use
int i;
do
{
PrintInteger(i);
i++;
} while (i < 5);
// do { statement; } while (expression);
// actual use
int i;
do
{
PrintInteger(i);
i++;
} while (i < 5);
author: Ryan Hunt, editors: Charles Feduke, Mistress, contributor: Ken Cotterill