Question #249

Author: admin
tags: Go  
package main

import (
	"fmt"
	"time"
)

func main() {
	c := make(chan string, 1)

	go transferNames(c)

	name := <-c
	fmt.Println(name)
	c <- "Bob"
	time.Sleep(time.Millisecond * 1000)
}

func transferNames(c chan string) {
	c <- "Tom"
	name := <-c
	fmt.Println(name)
	close(c)
}
What will be printed?
First "Bob", then "Tom"
First "Tom", then "Bob"
Only "Tom"
Only "Bob"
The code will not be compiled
Rate the difficulty of the question:
easyhard