Challenge: Reviewing Concepts of Functions
Task
- Finish the code for the second parameter of the
operate
function, which is expected to accept thecapitalize
function; - Review the code and provide suitable arguments in the
operate
function call within themain()
function; - Save the returned values from the
operate
function call into the variablesoriginal
andupdated
.
index.go
1234567891011121314151617181920212223package main import "fmt" // `ToLower()` and `ToUpper()` functions are imported from the `strings` module import "strings" func capitalize(str string) string { return strings.ToUpper(str) } func operate(str string, operation ___) (string, string) { return str, operation(str) } func main() { inputString := "Hello World" var original string var updated string ___ = operate(___) fmt.Println(original, updated) }
Var alt klart?
Tak for dine kommentarer!
Sektion 4. Kapitel 7
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Suggested prompts:
Can you explain how the operate function works?
What does the capitalize function do in this context?
Can you show the output of the main function?
Awesome!
Completion rate improved to 1.96
Challenge: Reviewing Concepts of Functions
Stryg for at vise menuen
Task
- Finish the code for the second parameter of the
operate
function, which is expected to accept thecapitalize
function; - Review the code and provide suitable arguments in the
operate
function call within themain()
function; - Save the returned values from the
operate
function call into the variablesoriginal
andupdated
.
index.go
1234567891011121314151617181920212223package main import "fmt" // `ToLower()` and `ToUpper()` functions are imported from the `strings` module import "strings" func capitalize(str string) string { return strings.ToUpper(str) } func operate(str string, operation ___) (string, string) { return str, operation(str) } func main() { inputString := "Hello World" var original string var updated string ___ = operate(___) fmt.Println(original, updated) }
Var alt klart?
Tak for dine kommentarer!
Sektion 4. Kapitel 7