Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
- }
Add Comment
Please, Sign In to add comment