Skip to content

swift-arrays-lab-swift-intro-000 #210

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
33 changes: 21 additions & 12 deletions Arrays.playground/Pages/main.xcplaygroundpage/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
// write your code here




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


/*: question2
### 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", "Tomatoes"]



Expand All @@ -33,16 +32,17 @@
// write your code here


var futureShoppingList: [String]


futureShoppingList = ["Bread", "Butter", "Cheese", "Lettuce", "Tomatoes"]


/*: question4
### 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", "Lettuce", "Tomatoes"]



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



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



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



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



Expand All @@ -76,9 +76,8 @@






var itemToPrint = shoppingList[1]
print(itemToPrint)


/*: question8
Expand All @@ -87,6 +86,8 @@
// write your code here


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



Expand All @@ -98,6 +99,14 @@
*/
// write your code here

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

} else {
return false
}
}



Expand All @@ -110,7 +119,7 @@




print(lifesEssential(shoppingList))



Expand All @@ -121,7 +130,7 @@
// write your code here



print(lifesEssential(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