Rearrange the lines so that the resulting function would print the value for the key if it's found in the context and a special message if it's not found.
Context package
Looking for a Value
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
return
}
if val := ctx.Value(key); val != nil {
fmt.Println(key, "value is not found")
func lookForValue(ctx context.Context, key myVeryOwnContextKey) {
fmt.Println("value for", key, "is", val)
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.