We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In the book, the example is shown as
`func location(name, city string) (region, continent string) { switch city { case "New York", "LA", "Chicago": continent = "North America" default: continent = "Unknown" } return }
func main() { region, continent := location("Matt", "LA") fmt.Printf("%s lives in %s", region, continent) }`
But, the Go Playground shows
`package main
import "fmt"
func location(city string) (region, continent string) { switch city { case "Los Angeles", "LA", "Santa Monica": region, continent = "California", "North America" case "New York", "NYC": region, continent = "New York", "North America" default: region, continent = "Unknown", "Unknown" } return }
func main() { region, continent := location("Santa Monica") fmt.Printf("Matt lives in %s, %s", region, continent) } `
The Playground seems to be more correct than the code shown in the book text.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the book, the example is shown as
`func location(name, city string) (region, continent string) {
switch city {
case "New York", "LA", "Chicago":
continent = "North America"
default:
continent = "Unknown"
}
return
}
func main() {
region, continent := location("Matt", "LA")
fmt.Printf("%s lives in %s", region, continent)
}`
But, the Go Playground shows
`package main
import "fmt"
func location(city string) (region, continent string) {
switch city {
case "Los Angeles", "LA", "Santa Monica":
region, continent = "California", "North America"
case "New York", "NYC":
region, continent = "New York", "North America"
default:
region, continent = "Unknown", "Unknown"
}
return
}
func main() {
region, continent := location("Santa Monica")
fmt.Printf("Matt lives in %s, %s", region, continent)
}
`
The Playground seems to be more correct than the code shown in the book text.
The text was updated successfully, but these errors were encountered: