We've written this code:
func mainFunction() {
fmt.Println("Hello AlgoCademy!")
fmt.Println("Coding is amazing!")
fmt.Println("Functions are so useful!")
fmt.Println("Hello AlgoCademy!")
fmt.Println("Coding is amazing!")
fmt.Println("Functions are so useful!")
fmt.Println("Hello AlgoCademy!")
fmt.Println("Coding is amazing!")
fmt.Println("Functions are so useful!")
}
Write the same code in a better way by creating and calling a function printMessages().
The function should print:
Hello AlgoCademy!
Coding is amazing!
Functions are so useful!
Assignment
Define printMessages, then call it three times from mainFunction.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
