From 55d3e0b00f9038eee764191e00e9728151afa7ca Mon Sep 17 00:00:00 2001 From: ezsmith Date: Sun, 3 Jun 2018 16:28:32 -0700 Subject: [PATCH] new lab on arrays --- .../main.xcplaygroundpage/Contents.swift | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift index f77d3a8..2e48a42 100644 --- a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -13,7 +13,10 @@ */ // write your code here + var list = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] + print("please buy \(list[1])") + print("hello") @@ -23,7 +26,7 @@ */ // write your code here - + var shoppingList: [String] = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -32,7 +35,8 @@ */ // write your code here - +var futureShoppingList: [String] +futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -42,6 +46,8 @@ */ // write your code here +let cheeseSandwich: [String] +futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -52,7 +58,7 @@ */ // write your code here - +let dessertList: [String] = ["Cookie dough", "Icecream"] @@ -63,7 +69,7 @@ // write your code here - +let afternoonAttendance: [Int] = [2, 10, 3, 15, 7] @@ -75,6 +81,8 @@ // write your code here +shoppingList[1] = "itemToPrint" +print(shoppingList[1]) @@ -86,7 +94,8 @@ */ // write your code here - +futureShoppingList[2] = "Chicken" +print(futureShoppingList) @@ -98,7 +107,13 @@ */ // write your code here - +func lifesEssential(ingredients: [String]) -> Bool { + if ingredients[0] == "Bread" { + return true + } else { + return false + } +} @@ -108,6 +123,7 @@ */ // write your code here +print(lifesEssential(ingredients: shoppingList)) @@ -120,7 +136,7 @@ */ // write your code here - +print(lifesEssential(ingredients: dessertList)) //: Click [here](https://github.com/learn-co-curriculum/swift-arrays-lab/blob/solution/Arrays.playground/Pages/solution.xcplaygroundpage/Contents.swift) for the solution.