Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSamuel Johnson
167 PointsHow to return a string in a function?
unable to proceed further package blackjack
import "fmt"
func PlayHand(score int) string { // YOUR CODE HERE if score < 17 { fmt.Println("hit me") } else if score > 21 { fmt.Println("bust") } else { fmt.Println("Stand") } return }
package blackjack
import "fmt"
func PlayHand(score int) string {
// YOUR CODE HERE
if score < 17 {
fmt.Println("hit me")
} else if score > 21 {
fmt.Println("bust")
} else {
fmt.Println("Stand")
}
return
}
2 Answers
Samuel Johnson
167 PointsThank you so much KRIS NIKOLAISEN , it finally worked. You were so quick to answer and made me understand clearly. Thanks again.
package blackjack
func PlayHand(score int) string {
// YOUR CODE HERE
if score < 17 {
return "hit me"
} else if score > 21 {
return "bust"
} else {
return "stand"
}
}
KRIS NIKOLAISEN
54,972 PointsYou won't be printing anything so you don't need import "fmt"
. Then if you just replace each fmt.Println
with return
and eliminate the last return
you already have you should be good. Also note: "Stand" should start with a lowercase "s".