Last active
December 10, 2015 04:08
-
-
Save tenntenn/4379518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func input(ans chan int) { | |
r := bufio.NewReader(os.Stdin) | |
for { | |
line, _, err := r.ReadLine() | |
if err != nil { | |
fmt.Print(">") | |
continue | |
} | |
str := strings.Replace(string(line), "\r", "", -1) | |
n, err := strconv.Atoi(str) | |
if err != nil { | |
fmt.Print(">") | |
continue | |
} | |
ans <- n | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment