From ffe338b9d10e4addfb00a5b21fdab232372ea9fb Mon Sep 17 00:00:00 2001 From: Gunasai Garapati Date: Fri, 26 Oct 2018 15:50:12 -0400 Subject: [PATCH] finished exercises --- .../Pages/main.xcplaygroundpage/Contents.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift index c1f926f..49d88b2 100644 --- a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -14,7 +14,9 @@ ### 1. Create a function that will take in a continent and the number of countries in that continent. It should print the following sentence "____ is a continent which contains ___ countries". */ // write your code here - +func continent(name: String, numContinents: Int) { + print("\(name) is a continent which contains \(numContinents) countries.") +} @@ -25,7 +27,7 @@ func greeting(name: String, greeting: String) { print("\(greeting), \(name)!") } -greeting(name: "Danny", "Hello") +greeting(name: "Danny", greeting: "Hello") @@ -33,7 +35,7 @@ greeting(name: "Danny", "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)") } @@ -47,7 +49,15 @@ daysInMonth(month: "November", days: 30) */ // write your code here +func beverages(beverage: String, numberOfBottles: Int, holder: String) { + print("\(numberOfBottles) bottles of \(beverage) on the \(holder)") +} + +let beverage = "soda" +let numBottles = 64 +let holder = "counter top" +beverages(beverage: beverage, numberOfBottles: numBottles, holder: holder) //: Click [here](https://github.com/learn-co-curriculum/swift-funcMultipleArg-lab/blob/solution/MyPlayground.playground/Pages/solution.xcplaygroundpage/Contents.swift) to see the solution.