diff --git a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift index f77d3a8..990c9e6 100644 --- a/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -12,7 +12,7 @@ ### 1. Write an array called 'list' **without** a type specified that contains the string values "Bread", "Butter", "Cheese", "Lettuce", "Tomatoes". */ // write your code here - +var list: [String] = ["Bread", "Butter", "Cheese", "Lettuce"] @@ -22,7 +22,7 @@ ### 2. Write an array called 'shoppingList' **with** a type specified that contains the string values "Bread", "Butter", "Cheese", "Lettuce", "Tomatoes". */ // write your code here - +var shoppingList: [String] = ["Bread", "Butter","Cheese","Lettuce"] @@ -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.append("Bread") @@ -41,7 +43,7 @@ ### 4. Write an array called 'cheeseSandwich' **with** a type specified whose value will never change (constant) and contains the string values "Bread", "Butter", "Cheese", "Lettuce", "Tomatoes". */ // write your code here - +let cheeseSandwich: [String] = ["Bread","Butter","Cheese"] @@ -51,7 +53,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,7 +64,7 @@ */ // write your code here - +var afternoonAttendance: [Int] = [2,10,3,15,7] @@ -75,7 +77,8 @@ // write your code here - +//shoppingList[1] = "itemtoPrint" +print(shoppingList) @@ -85,6 +88,8 @@ ### 8. Change the value of 'Cheese' in the 'futureShoppingList' array to 'Chicken' and then print the array to the console. */ // write your code here +futureShoppingList[2] = "Chicken" +print(futureShoppingList)