Blue pill or Red pill?

Report a typo

Keanu has been learning about Go functions and has created a function takePill that asks the user of the program to pick the red or the blue pill. However, he forgot to call his function within the main function!

Can you help out Keanu by fixing his code and calling his function properly ?

Sample Input 1:

red

Sample Output 1:

You stay in wonderland, and see how deep the rabbit hole goes.
Write a program in Go
package main

import "fmt"

// Do not change the code of this function!
func takePill(pill string) string {
switch pill {
case "red":
return "You stay in wonderland, and see how deep the rabbit hole goes."
case "blue":
return "The story ends, you wake up in bed and believe what you want to believe."
default:
return "You wake up in a strange place, and you don't know what to do."
}
}

func main() {
var selection string
fmt.Scanf("%s", &selection)

// Call takePill() within fmt.Println() below, and pass 'selection' to takePill() as an argument:
fmt.Println(?)
}
___

Create a free account to access the full topic