In VB, I can write a loop that always runs at least once. For instance:
Do [code] Loop While [condition]
Is there any way to do this in C #?
Sure:
do { ... } while (condition);
See do (C# Reference) .
do (C# Reference)
do { // code } while (condition)
As an alternative
bool finished = false ; while ( !finished ) { // do something finished = // evaluate a new foo }
I have never been a big fan of do / while
TopOfLoop: // ... if (condition) { goto TopOfLoop; }
No career is complete without at least one goto .
goto
Source: https://habr.com/ru/post/1335616/More articles:JavaDoc reuse parameter values - javaIs it possible to reuse @param descriptions in JavaDoc? - javaProgramming DirectX in C? - c ++C # EF Linq bitwise question - bit-manipulationcomment code - javaRails: populate the selection list using the US states and abbreviation using Decoder :: Countries [: US] .states - sortingDisable display: none in CSS for TD - javascriptCreating a TAG database - designpractical use for undef - ruby | fooobar.comWhy can't I write "implements AClass" in Java? - javaAll Articles