You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In section "Functions As Data" you wrote the code below. Since activity is a slice and not a map you should refrain from using the word variable name "key", instead use variable name "index", since keys are associated with maps not slices or arrays.
Changing the name will make your code much easier to read and understand.
You wrote:
func compose(p phrases, a []activity) (func()){
return func(){
for key, value := range a{
fmt.Print(p[value])
if key == len(a)-1{
fmt.Println(".")
} else {
fmt.Print(" and ")
}
}
}
}
Should be corrected in following manner (see use of variable name "index" in place of "key")
func compose(p phrases, a []activity) (func()){
return func(){
for index, value := range a{
fmt.Print(p[value])
if index == len(a)-1{
fmt.Println(".")
} else {
fmt.Print(" and ")
}
}
}
}
The text was updated successfully, but these errors were encountered:
Hi Yuuta,
In section "Functions As Data" you wrote the code below. Since activity is a slice and not a map you should refrain from using the word variable name "key", instead use variable name "index", since keys are associated with maps not slices or arrays.
Changing the name will make your code much easier to read and understand.
You wrote:
Should be corrected in following manner (see use of variable name "index" in place of "key")
The text was updated successfully, but these errors were encountered: