Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Reviewing Concepts of Functions | Functions
Introduzione a Golang

bookChallenge: Reviewing Concepts of Functions

Task

  1. Finish the code for the second parameter of the operate function, which is expected to accept the capitalize function;
  2. Review the code and provide suitable arguments in the operate function call within the main() function;
  3. Save the returned values from the operate function call into the variables original and updated.
index.go

index.go

copy
1234567891011121314151617181920212223
package 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) }

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 7

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

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

bookChallenge: Reviewing Concepts of Functions

Scorri per mostrare il menu

Task

  1. Finish the code for the second parameter of the operate function, which is expected to accept the capitalize function;
  2. Review the code and provide suitable arguments in the operate function call within the main() function;
  3. Save the returned values from the operate function call into the variables original and updated.
index.go

index.go

copy
1234567891011121314151617181920212223
package 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) }

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 7
some-alt