This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func vend(itemNamed name: String) throws { | |
let item = try validatedItemNamed(name) | |
reduceDepositedCoinsBy(item.price) | |
removeFromInventory(item, name: name) | |
dispense(name) | |
} | |
private func validatedItemNamed(name: String) throws -> Item { | |
let item = try itemNamed(name) | |
try validate(item) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)checkAnswer:(int)answer { | |
if(rightAnswer==answer) | |
{ | |
//AudioServicesPlaySystemSound(_tweetSound); | |
score++; | |
} | |
else { | |
//AudioServicesPlaySystemSound(_barkSound); | |
} | |
[self updateScore]; |