Re: Why use while if only iterating once ?

2018-11-06 Thread Dukc via Digitalmars-d-learn
On Saturday, 3 November 2018 at 21:13:49 UTC, Jonathan M Davis wrote: There's a continue right above the default case. So, if the code hits that point, it will loop back to the top. - Jonathan M Davis There's also the benefit that FLAGS f exists only until the end of the loop, and thus

Re: Why use while if only iterating once ?

2018-11-03 Thread Venkat via Digitalmars-d-learn
Thankyou. As the great Gump's mother said, stupid is as stupid does.

Re: Why use while if only iterating once ?

2018-11-03 Thread lithium iodate via Digitalmars-d-learn
On Saturday, 3 November 2018 at 21:03:16 UTC, Venkat wrote: The last break statement prevents the loop from returned for a second iteration. Then why use a while ? The continue statement may abort the current iteration and start the next, causing the final break to not necessarily be executed

Re: Why use while if only iterating once ?

2018-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, November 3, 2018 3:03:16 PM MDT Venkat via Digitalmars-d-learn wrote: > while (1) > { > FLAGS f; > switch (*p) > { > case 'U': > case 'u': > f = FLAGS.unsigned; > goto

Why use while if only iterating once ?

2018-11-03 Thread Venkat via Digitalmars-d-learn
while (1) { FLAGS f; switch (*p) { case 'U': case 'u': f = FLAGS.unsigned; goto L1; case 'l': f = FLAGS.long_; error("lower case integer suffix