Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
while(expression)
statement
The while keyword executes statement repeatedly until expression becomes 0.
For more information, see do, for, break, and continue.
Example
This example copies characters from string2
to string1
. If i
is greater than or equal to 0, string2[i]
is assigned to string1[i]
and i
is decremented. When i
reaches or falls below 0, execution of the while statement terminates.
// Example of the while statement
while ( i >= 0 )
{
string1[i] = string2[i];
i--;
}
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in