static void Main(string[] args) { Player player = new Player(); for (int i = 0; i < 20; i++) { player.Hit(); Console.WriteLine($"Is player alive : {player.IsAlive}"); } }
static void Main(string[] args) { Player player = new Player(); do { player.Hit(); Console.WriteLine("Is player alive: " + player.IsAlive); } while (player.IsAlive); }
static void Main(string[] args) { Player player = new Player(); for (int i = 0; i < 20; i++) { player.Hit(); Console.WriteLine("Is player alive: " + player.IsAlive); } }
static void Main(string[] args) { Player player = new Player(); for (int i = 0; i < 20; i++) { player.Hit(); player.CheckDeath(); Console.WriteLine("Is player alive: " + player.isAlive); } }
static void Main(string[] args) { Player player = new Player(); for (int i = 0; i < 20 && player.bored; i++) { //player.bored = false; player.Hit(); Console.WriteLine("Is player alive: " + player.isAlive); } }
static void Main(string[] args) { Player player = new Player(); //can't do this because property is read-only //properties great way to embed functionality //into getters and setters //player.IsAlive = false; for (int i = 0; i < 20; i++) { player.Hit(); Console.WriteLine("Is player alive" + player.IsAlive); } }