Last active
January 13, 2018 23:01
-
-
Save ankitvijay/fe0f5a5b320deaee2c1af9aa1a3160b8 to your computer and use it in GitHub Desktop.
Non Short Circuit Example 1
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 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