Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Last active November 29, 2017 10:39
Show Gist options
  • Save luisdeol/331b92403d35c0b15a18b80b1b291275 to your computer and use it in GitHub Desktop.
Save luisdeol/331b92403d35c0b15a18b80b1b291275 to your computer and use it in GitHub Desktop.
Use the while and do-while to manage the program flow
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