As you can see, there is an infinite loop nested within another infinite loop. One of my favorite aspects of Go is the
for loop, which is the only kind of loop and used to create any kind of other loop. Loops!
The main function kicks off the first infinite
for loop. This calls the
stringPrompt function which starts the second infinite loop to capture input via
stdin and waits for the user to press a
\n. Then it returns the captured
main which prints it out for demo purposes before it starts all over again.