do Loop

From NWN Lexicon
Jump to: navigation, search

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);

 author: Ryan Hunt, editors: Charles Feduke, Mistress, contributor: Ken Cotterill