I’m trying to print a prompt, then leave the cursor on the same line for user input. But when I execute println("> ") the cursor moves to the next line. How can I do this?
The “ln” in println
indicates the newline.
You can try with only print
print("> ")
I want the newline before the prompt, it’s the newline after the prompt that aI want to suppress.
Thanks for the response.
print("\n>")
or just
println()
print(">")
1 Like
Thanks for the suggestion. I just tried that and it still goes to the next line after the prompt.
Just using print works, thanks!
You may want to look at Base.prompt
:
julia> msg = Base.prompt("Type something");
Type something: Hello!
julia> msg
"Hello!"
4 Likes
Thanks for the suggestion.