//: Playground - noun: a place where people can play

import UIKit


var length = 12
var width = 14
var area = length * width

var length2 = 10
var width2 = 9
var area2 = length2 * width2

var length3 = 13
var width3 = 15
var area3 = length3 * width3


func calcArea(width : Int, length : Int) -> Int{
    // what to do
    let area = width * length
    return area
}

print(calcArea(width: 12, length: 14))
print(calcArea(width: 10, length: 9))


func purchase(currentBalance : Double, price: Double) -> Double{
    var newBalance : Double = currentBalance
    if price <= currentBalance {
        print("purchased : $\(price)")
        newBalance = currentBalance - price
    } else {
        print("Sorry! you should learn how to save money.")
    }
    
    print("Your account balance is : $ \(newBalance)")
    return newBalance
}

var bankAccountBalance = 500.0
var shoesPrice = 280.9

bankAccountBalance = purchase(currentBalance: bankAccountBalance, price: shoesPrice)

bankAccountBalance = purchase(currentBalance: bankAccountBalance, price: 100)
bankAccountBalance = purchase(currentBalance: bankAccountBalance, price: 210)


