diff --git a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift index f77d3a8..26432e2 100644 --- a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -13,7 +13,7 @@ */ // write your code here - +var list = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -23,7 +23,7 @@ */ // write your code here - +var shoppingList: [String] = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -31,7 +31,9 @@ ### 3. Initialize an array called 'futureShoppingList' **with** a type specified and then add the string values "Bread", "Butter", "Cheese", "Lettuce", "Tomatoes". */ // write your code here +var futureShoppingList: [String] +futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -42,6 +44,7 @@ */ // write your code here +let cheeseSandwich: [String] = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"] @@ -51,7 +54,7 @@ ### 5. Create a second array called 'dessertList' with a type specified which contains the string values "Cookie dough", "Icecream" */ // write your code here - +var dessertList: [String] = ["Cookie dough", "Icecream"] @@ -62,8 +65,7 @@ */ // write your code here - - +var afternoonAttendance: [Int] = [2, 10, 3, 15, 7] @@ -75,6 +77,8 @@ // write your code here +var itemToPrint = shoppingList[1] +print(itemToPrint) @@ -87,7 +91,8 @@ // write your code here - +futureShoppingList[2] = "Chicken" +print(futureShoppingList) @@ -98,7 +103,13 @@ */ // write your code here - +func lifesEssential(ingredients: Array) -> Bool { + if ingredients[0] == "Bread" { + return true + } else { + return false + } +} @@ -109,7 +120,7 @@ // write your code here - +print(lifesEssential(ingredients: shoppingList)) @@ -119,7 +130,7 @@ ### 11. Pass the 'desertList' array to the 'lifesEssential' function and print the result. */ // write your code here - +print(lifesEssential(ingredients: dessertList)) diff --git a/Arrays.playground/playground.xcworkspace/contents.xcworkspacedata b/Arrays.playground/playground.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Arrays.playground/playground.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Arrays.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Arrays.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Arrays.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Arrays.playground/playground.xcworkspace/xcuserdata/michaelsoares.xcuserdatad/UserInterfaceState.xcuserstate b/Arrays.playground/playground.xcworkspace/xcuserdata/michaelsoares.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..be6f999 Binary files /dev/null and b/Arrays.playground/playground.xcworkspace/xcuserdata/michaelsoares.xcuserdatad/UserInterfaceState.xcuserstate differ