jonjamster
3/6/2018 - 12:01 PM

Variables and Constants - Get Milk


 
 func getMilk(howManyMilkCartons : Int, howMuchMoneyRobotWasGiven : Int) -> Int {
 
         print("Go to the Shops")
         print("Buy \(howManyMilkCartons) Cartons of Milk")
 
         let priceToPay = howManyMilkCartons * 2
 
         print("Pay £\(priceToPay)")
         print("Come Home")
    
    let change = howMuchMoneyRobotWasGiven - priceToPay
    

 return change
    
    
  }
 
 
 
 
var amountOfChange = getMilk(howManyMilkCartons: 10, howMuchMoneyRobotWasGiven: 100
 )

print("Here is your £\(amountOfChange) change")