Hi,
Can anybody please explain the Difference between for and while loop?
Thanks
Ankit
Hi,
Can anybody please explain the Difference between for and while loop?
Thanks
Ankit
They're not entirely interchangeable.
In a for loop, 'b' can be empty whereas a while loop must always have an expression.
The continue keyword works differently as well, where 'c' is evaluated in the for loop, but skipped in the while loop.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.