Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Do while loop
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Equivalent constructs== <syntaxhighlight lang="c"> do { do_work(); } while (condition); </syntaxhighlight> is equivalent to <syntaxhighlight lang="c"> do_work(); while (condition) { do_work(); } </syntaxhighlight> In this manner, the do ... while loop saves the initial "loop priming" with <code>do_work();</code> on the line before the <code>while</code> loop. As long as the ''continue'' statement is not used, the above is technically equivalent to the following (though these examples are not typical or modern style used in everyday computers): <syntaxhighlight lang="c"> while (true) { do_work(); if (!condition) break; } </syntaxhighlight> or <syntaxhighlight lang="c"> LOOPSTART: do_work(); if (condition) goto LOOPSTART; </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)