Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Difference between a while loop and a do while loop?

The expression gets checked on the while loop first and then the code will executed. On the do while the code gets executed before the expression gets checked.
while(under_condition)
{
do stuff
}

//
do
{
do_this_atleast_once_before_while_loop_starts
} while (under_condition)
You basically just add one more expression before your while loop.

while(condition)
{
expression
}


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by ohxerxeFeb 4, 2018 03:26 PM 3 304 Feb 4, 2018 03:26 PM
Last Post: matt
[Java] by prodigyhfSep 1, 2017 05:22 PM 0 223 Sep 1, 2017 05:22 PM
Last Post: prodigyhf
[C#] by jrbuchnerAug 4, 2013 02:22 AM 2 104 Aug 4, 2013 02:22 AM
Last Post: iVision