public static void Main(string[] args) { Potato potato = new Potato(); Chef chef = new Chef(); if (potato == null) { throw new NullReferenceException(); } else { if (potato.HasBeenPeeled && !potato.IsRotten) { chef.Cook(potato); } } }
public static void Main() { /* Potato potato; if (potato != null) if (!potato.HasNotBeenPeeled && !potato.IsRotten) Cook(potato); */ Potato potato = new Potato(); Chef chef = new Chef(); potato.IsPeeled = true; potato.IsRotten = false; if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { chef.Cook(potato); } } /* if (x >= MIN_X && (x =< MAX_X && ((MAX_Y >= y && MIN_Y <= y) && !shouldNotVisitCell))) { VisitCell(); } */ int x = 4; int y = 5; bool shouldVisitCell = true; if (InRange(x, y) && shouldVisitCell) { VisitCell(); } }