Skip to content
Open
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
17 changes: 10 additions & 7 deletions MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@
*/
// write your code here




func continent(continent: String, numberOfNations: Int){
print("\(continent) is a continent which contains \(numberOfNations) countries")
}
continent(continent: "Europe", numberOfNations: 51)
/*: question2
### 2. Can you see why the code below doesn't work? Fix the function call to get rid of the error.
*/
func greeting(name: String, greeting: String) {
print("\(greeting), \(name)!")
}

greeting(name: "Danny", "Hello")
greeting(name: "Danny", greeting: "Hello")




/*: question3
### 3. This function doesn't work, either. Can you fix the function (_not_ the call) so that it works?
*/
func daysInMonth(month: String, days: String) {
func daysInMonth(month: String, days: Int) {
print("There are \(days) in \(month)")
}

Expand All @@ -45,9 +46,11 @@ daysInMonth(month: "November", days: 30)
/*: question4
### 4. So far, you have created functions that take two arguments. Can you create (and call) one that takes three? Try to create a function that three parameters: a beverage, the number of bottles of that beverage, and a place you can keep those bottles. Print the sentence "____ bottles of ____ on the ____ wall."
*/
// write your code here

func wall(beverage: String, numberOfBottles: Int, location: String){
print("\(numberOfBottles) bottles of \(beverage) on the \(location) wall.")
}

wall(beverage: "beer", numberOfBottles: 99, location: "")


//: Click [here](https://github.com/learn-co-curriculum/swift-funcMultipleArg-lab/blob/solution/MyPlayground.playground/Pages/solution.xcplaygroundpage/Contents.swift) to see the solution.