Skip to content

new lab on arrays #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
*/
// write your code here

var list = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"]

print("please buy \(list[1])")
print("hello")



Expand All @@ -23,7 +26,7 @@
*/
// write your code here


var shoppingList: [String] = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"]



Expand All @@ -32,7 +35,8 @@
*/
// write your code here


var futureShoppingList: [String]
futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"]



Expand All @@ -42,6 +46,8 @@
*/
// write your code here

let cheeseSandwich: [String]
futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"]



Expand All @@ -52,7 +58,7 @@
*/
// write your code here


let dessertList: [String] = ["Cookie dough", "Icecream"]



Expand All @@ -63,7 +69,7 @@
// write your code here



let afternoonAttendance: [Int] = [2, 10, 3, 15, 7]



Expand All @@ -75,6 +81,8 @@
// write your code here


shoppingList[1] = "itemToPrint"
print(shoppingList[1])



Expand All @@ -86,7 +94,8 @@
*/
// write your code here


futureShoppingList[2] = "Chicken"
print(futureShoppingList)



Expand All @@ -98,7 +107,13 @@
*/
// write your code here


func lifesEssential(ingredients: [String]) -> Bool {
if ingredients[0] == "Bread" {
return true
} else {
return false
}
}



Expand All @@ -108,6 +123,7 @@
*/
// write your code here

print(lifesEssential(ingredients: shoppingList))



Expand All @@ -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.
Expand Down