Last active
November 29, 2017 10:39
-
-
Save luisdeol/331b92403d35c0b15a18b80b1b291275 to your computer and use it in GitHub Desktop.
Use the while and do-while to manage the program flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace implement_program_flow | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var mainstreamCount = 0; | |
while (mainstreamCount > 0) | |
{ | |
Console.WriteLine($"MainstreamCount: {mainstreamCount}"); | |
mainstreamCount--; | |
} | |
do | |
{ | |
Console.WriteLine("At least this executes once!"); | |
mainstreamCount--; | |
} while (mainstreamCount > 0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment