O'Reilly logo

Swift Programming: The Big Nerd Ranch Guide by John Gallagher, Matthew Mathias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bronze Challenge

There is currently a bug in the Zombie type. If an instance of Zombie terrorizes a town with a population of 0, then its population will decrement to -10. This result does not make sense. Fix this bug by changing the terrorizeTown() method on the Zombie type to only decrement the town’s population if its population is greater than 0. Also, make sure that the town’s population is set to 0 if the amount to decrement is greater than the current population.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required