Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added CurrencyConverter /.DS_Store
Binary file not shown.
File renamed without changes.
56 changes: 56 additions & 0 deletions CurrencyConverter.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import UIKit

enum Currency {
case cad
case mxn
}

let usToCad = 1.40
let usToMxn = 23.59
var currency: Currency = .cad

let usd: Double = 1.00

func convert(dollars: Double) -> Double {
switch currency {
case .cad:
return usToCad
case .mxn:
return usToMxn
default:
return dollars
}
}

//func convert(amountString: String) -> String? {
// let amount: Double
// amount = amountString
//
// guard let amount = amountString else {
// print("Invalid amount")
// return
// }
//}
//var currencyFormatter = NumberFormatter = {
// let formatter = NumberFormatter()
// formatter.numberStyle = .currency
// return formatter
//} ()
//}







//func multiply(firstNumber: Int, secondNumber: Int) -> Int {
// let total = firstNumber * secondNumber
// return total
//}
//
//let numberOne = 4
//let numberTwo = 5
//
//multiply(firstNumber: numberOne, secondNumber: numberTwo)

4 changes: 4 additions & 0 deletions CurrencyConverter.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.