Created
January 13, 2018 23:14
-
-
Save ankitvijay/439f4e7ae3b3897abdfff59671c39c4c to your computer and use it in GitHub Desktop.
Non Short Circuit Example 2
This file contains 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
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