Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Last active January 13, 2018 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitvijay/fe0f5a5b320deaee2c1af9aa1a3160b8 to your computer and use it in GitHub Desktop.
Save ankitvijay/fe0f5a5b320deaee2c1af9aa1a3160b8 to your computer and use it in GitHub Desktop.
Non Short Circuit Example 1
using System;
namespace ShortCircuitExample
{
public class Program
{
static void Main(string[] args)
{
if (IsStoreOpen() && NeedGrocery())
{
Console.WriteLine("Go to store");
}
else
{
Console.WriteLine("Stay at home");
}
Console.Read();
}
private static bool NeedGrocery()
{
Console.WriteLine("Need grocery");
return false;
}
private static bool IsStoreOpen()
{
Console.WriteLine("Is store open");
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment