Complete GoLang beginner here taking a college course. I have submitted some code that is working fine for me on my computer but my teacher is saying it compiles for him but does not run. I cannot find a solution anywhere and am having a hard time troubleshooting since it works fine for me.
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
var stringsList []string
for {
fmt.Print("String to add: ")
scanner.Scan()
input := scanner.Text()
stringsList = append(stringsList, input)
fmt.Print("Continue? [Y/n]: ")
scanner.Scan()
answer := scanner.Text()
if strings.ToLower(answer) != "y" {
break
}
}
joinedString := strings.Join(stringsList, ", ")
fmt.Println(joinedString)
}
Any help is appreciated!!