Skip to content

Instantly share code, notes, and snippets.

@hoang-tran
Last active July 30, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoang-tran/4987fa39dd28f6eb89f4d3b52c985623 to your computer and use it in GitHub Desktop.
Save hoang-tran/4987fa39dd28f6eb89f4d3b52c985623 to your computer and use it in GitHub Desktop.
import Foundation
class Gun: NSObject {
var bullets = 0
init(bullets: Int) {
self.bullets = bullets
}
func shoot() {
if self.bullets > 0 {
self.bullets -= 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment