Do-While statements do not look neat!

Whenever I use a do-while statement, it does not look neat. Its really annoying because most of my code looks quite neat then this just messes it all up!
Can anyone tell me how to make them neat!
Sorry, dont have an example.

Thanks!
In many cases you can use a while loop instead.
OK. but while statements still dont look thaaat much better.
Could you give an example?
Whenever I use a do-while statement, it does not look neat.


I share the sentiment. I prefer all of my braces to be alone on a line, and that looks very odd in a do-while loop. It violates my sense of symmetry. Unfortunately, sometimes it is the best tool for the job!
Just us a while loop. It does the same thing but looks nicer
Ok.
but, if I use while loops, they still look a bit... 'odd???'
Just us a while loop. It does the same thing but looks nicer


It doesn't quite do the same thing.

If the loop condition is false, do/while loops will still run at least once. Whereas while loops will not run at all.


Right tool for the right job. do/whiles don't look that bad, really. Templates look far worse, but that doesn't stop me from using them.
So, there isnt really a way of making them look neater?
Well 'neat' is very subjective.

I write mine like this:

1
2
3
4
5
do
{
   SomeStuff();
   MoreStuff();
}while( some_condition );


Personally I think that looks just fine.
So, there isnt really a way of making them look neater?

That depends on what you mean with neater. I use the same style as Disch and it looks neat enough to me
Ya, thats what I do as well... I guess im being a bit too pesky.

Anyway thank you.
Topic archived. No new replies allowed.