public static void Main() { Potato myPotato = new Potato(); // ... if (myPotato != null && myPotato.IsPeeled && !myPotato.IsRotten) { myPotato.Cook(); } int x = 5; int y = 15; bool shouldVisitCell = true; bool xIsInRange = MinX <= x && x <= MaxX; bool yIsInRange = MinY <= y && y <= MaxY; if (xIsInRange && yIsInRange && shouldVisitCell) { VisitCell(); } }