Skip to content

Instantly share code, notes, and snippets.

@alskipp
Created February 28, 2015 16:18
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 alskipp/b7fea13c971824f75191 to your computer and use it in GitHub Desktop.
Save alskipp/b7fea13c971824f75191 to your computer and use it in GitHub Desktop.
Build a DeathStar without PFI sub-contractors
struct DeathStar {
let guns:Int, cakes:Int, beer:Int
let troops:Int, toilets:Int, vendingMachines:Int
let commander:String
init(guns:Int, cakes:Int=0, beer:Int=0, troops:Int=1000,
toilets:Int=1, vendingMachines:Int=0, commander:String="Darth") {
self.guns = guns
self.cakes = cakes
self.beer = beer
self.troops = troops
self.toilets = toilets
self.vendingMachines = vendingMachines
self.commander = commander
}
}
let empire = DeathStar(guns:0,
beer:10_000,
vendingMachines:100,
cakes:1000,
commander:"Homer")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment