Skip to content

YOOO DADDY #468

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
69 changes: 49 additions & 20 deletions MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
// write your code here


func frozen() {
print("Let it go!")
}



Expand All @@ -27,7 +29,10 @@
*/
// write your code here


func frozenAgain() {
let letItGo = "Let it go!"
print(letItGo)
}



Expand All @@ -38,7 +43,9 @@
*/
// write your code here


func charactersName(name: String) {
print("My favorite character is \(name).")
}



Expand All @@ -48,8 +55,11 @@
### 4. Call the function you wrote in Question 3 using a constant you define. Then call it using a variable. Change the value of the variable, and call it again. What do you see in the console?
*/
// write your code here
let Ted = "Ted"
charactersName(name: Ted)


var Norm = "Norm"
charactersName(name: Norm)



Expand All @@ -60,7 +70,9 @@
*/
// write your code here


func number(problems: Int) {
print("I got \(problems) but Swift ain't one.")
}



Expand All @@ -72,19 +84,21 @@
*/
// write your code here



func band(bandName: String, bandNumber: Int) {
print("My #\(bandNumber) favorite band is \(bandName).")
}
band(bandName: "DoggyDog", bandNumber: 12)



/*: question7
### 7. The code below is broken. Can you identify which line has an error and fix it so that it works again? Uncomment the code below before starting.
*/
//func badFavoriteBand(bandName: String, position: Int) {
// print("My #\(position) favorite band is \(bandName).")
//}
//
//badFavoriteBand("The Beatles", 2)
func badFavoriteBand(bandName: String, position: Int) {
print("My #\(position) favorite band is \(bandName).")
}

badFavoriteBand(bandName: "The Beatles", position: 2)



Expand All @@ -95,11 +109,11 @@
/*: question8
### 8. This code is broken, too. Assume the call to the function is correct. What's broken about the function definition? Can you fix it? Uncomment the code below before starting.
*/
//func alsoBadFavoriteBand(bandName: String, position: String) {
// print("My #\(position) favorite band is \(bandName)")
//}
//
//alsoBadFavoriteBand(bandName: "Blink-182", position: 42)
func alsoBadFavoriteBand(bandName: String, position: Int) {
print("My #\(position) favorite band is \(bandName)")
}

alsoBadFavoriteBand(bandName: "Blink-182", position: 42)



Expand All @@ -112,8 +126,11 @@
*/
// write your code here

func madLib(charName: String, noun: String, preposition: String) {
print("To \(noun) and \(preposition), \(charName)!")
}


madLib(charName: "Fred", noun: "Ball", preposition: "What's a preposition")



Expand All @@ -123,6 +140,12 @@
*/
// write your code here

func buzz() -> String {
return "Buzz Lightyear to the rescue!"
}

print(buzz())




Expand All @@ -134,8 +157,11 @@
*/
// write your code here

func numb() -> Int {
return 29
}


print(numb())



Expand All @@ -144,8 +170,11 @@
*/
// write your code here

func char(name: String) -> String {
return("To infinity and beyond, \(name.uppercased())!")
}


print(char(name: "Fred"))



Expand Down