I’m using readlines() to get multi-line input with a non-fixed number of lines of user input from stdin, but I can’t get readlines() to stop taking input. I’ve tried alt+enter, esc+enter, shift+enter, alt+shift+enter, ctrl+enter, ctrl+D. How do I denote the end of my input? Thank you!
The VS Code REPL does not seem to handle readline()
properly - see this post.
FWIW, using a standard Julia REPL the following code works for me on Win10 to terminate with CTRL+D followed by ENTER (while the VS Code REPL misses the first input line):
function readlines_stdin()
lines = String[]
while true
s = readline(stdin)
Int(first(s)) == 4 && break # CTRL+D, then ENTER to exit
push!(lines, s)
end
return lines
end
lines = readlines_stdin()