Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Created January 13, 2018 23:14
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/439f4e7ae3b3897abdfff59671c39c4c to your computer and use it in GitHub Desktop.
Save ankitvijay/439f4e7ae3b3897abdfff59671c39c4c to your computer and use it in GitHub Desktop.
Non Short Circuit Example 2
using System;
namespace NonShortCircuitExample
{
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