Challenge A: Adding raw values

Taking the coin example from earlier in the chapter, begin with the following array of coins:

enum Coin: Int { case penny = 1 case nickel = 5 case dime = 10 case quarter = 25

}

let coinPurse: [Coin] = [.penny, .quarter, .nickel, .dime, .penny, .dime,

.quarter]

Write a function where you can pass in the array of coins, add up the value and return the number of cents.

results matching ""

    No results matching ""