In VB I can write a loop that always executes at least once. For example:
Do
[code]
Loop While [condition]
Is there a way to do that in C#?
In VB I can write a loop that always executes at least once. For example:
Do
[code]
Loop While [condition]
Is there a way to do that in C#?
Alternatively
bool finished = false ;
while ( !finished )
{
// do something
finished = // evaluate a new foo
}
I've never been a huge fan of do/while
TopOfLoop:
// ...
if (condition)
{
goto TopOfLoop;
}
No career is complete without at least one goto
.
goto
, it is better to do so as it can make your code unreadable and hard to maintainable.
Jan 9, 2021 at 21:30