Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created November 29, 2017 10:38
Show Gist options
  • Save luisdeol/527f4991228e1b3f90cb2bf8ad82141f to your computer and use it in GitHub Desktop.
Save luisdeol/527f4991228e1b3f90cb2bf8ad82141f to your computer and use it in GitHub Desktop.
Using the if and statement
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
var coffee = true;
var isDeadlineClose = false;
if (coffee)
{
Console.WriteLine("Let's study for some additional hours!");
coffee = false;
}
if (coffee)
{
Console.WriteLine("There are still more coffee!");
}
else if (isDeadlineClose)
{
coffee = true;
Console.WriteLine("Let's study for some additional hours!");
}
else
{
Console.WriteLine("It is time to sleep!");
var codeBlockVariable = "What's up?";
Console.WriteLine(codeBlockVariable);
}
// Console.WriteLine(codeBlockVariable); THROWS AN ERROR!
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment