From b8c52c7a1407d82cf33198d0abeab89a7c0badf3 Mon Sep 17 00:00:00 2001 From: Esmerlin Moya Date: Fri, 13 Jul 2018 23:50:14 -0400 Subject: [PATCH] Complete arrays --- .../main.xcplaygroundpage/Contents.swift | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift index f77d3a8..272570c 100644 --- a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -13,6 +13,7 @@ */ // write your code here +var list = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -24,6 +25,7 @@ // write your code here +var shoppingList: [String] = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -33,6 +35,10 @@ // write your code here +var futureShoppingList: [String] + +futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] + @@ -43,6 +49,7 @@ // write your code here +let cheeseSandwich: [String] = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -54,6 +61,7 @@ +var dessertList: [String] = ["Cookie dough", "Icecream"] @@ -63,6 +71,7 @@ // write your code here +var afternoonAttendence: [Int] = [2,10,3,15,7] @@ -75,6 +84,9 @@ // write your code here +shoppingList[1] = "itemToPrint" +var secondItem = shoppingList[1] +print(secondItem) @@ -87,6 +99,8 @@ // write your code here +futureShoppingList[2] = "Chicken" +print(futureShoppingList) @@ -100,6 +114,13 @@ +func lifesEssential(ingredients: [String]) -> Bool{ + if ingredients[0] == "Bread"{ + return true + } else { + return false + } +} @@ -111,6 +132,9 @@ +var result = lifesEssential(ingredients: shoppingList) +print(result) + @@ -120,7 +144,9 @@ */ // write your code here +var result2 = lifesEssential(ingredients: dessertList) +print(result2) //: Click [here](https://github.com/learn-co-curriculum/swift-arrays-lab/blob/solution/Arrays.playground/Pages/solution.xcplaygroundpage/Contents.swift) for the solution.