On 12/28/2011 8:29 AM, bearophile wrote:
One thing that I often find not handy in the design of do-while loops: the scope of their body ends before the "while":void main() { do { int x = 5; } while (x != 5); // Error: undefined identifier x }
I would just rewrite it like so: void main(){ while(true){ int x = 5; if(x != 5) continue; break; } }