# Printing a prompt and waiting for input

**URL:** <https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696>\
**Category:** New to Julia\
**Tags:** io\
**Created:** [August 20, 2021, 12:15am UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696 "2021-08-20T00:15:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgpdx](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dgpdx](https://discourse.julialang.org/u/dgpdx)\
**Post date:** [August 20, 2021, 12:15am UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/1 "2021-08-20T00:15:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [August 20, 2021, 5:09am UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/2 "2021-08-20T05:09:07Z")

</div>

The “ln” in `println` indicates the newline.  
You can try with only `print`

```julia
print("> ")

```

---

<div class="post-metadata">

**Author:** ![dgpdx](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dgpdx](https://discourse.julialang.org/u/dgpdx)\
**Post date:** [August 20, 2021, 1:44pm UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/3 "2021-08-20T13:44:49Z")

</div>

I want the newline before the prompt, it’s the newline after the prompt that aI want to suppress.  
Thanks for the response.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [August 20, 2021, 1:49pm UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/4 "2021-08-20T13:49:27Z")

</div>

```julia
print("\n>")

```

or just

```julia
println()
print(">")

```

---

<div class="post-metadata">

**Author:** ![dgpdx](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dgpdx](https://discourse.julialang.org/u/dgpdx)\
**Post date:** [August 20, 2021, 3:20pm UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/5 "2021-08-20T15:20:33Z")

</div>

Thanks for the suggestion. I just tried that and it still goes to the next line after the prompt.

---

<div class="post-metadata">

**Author:** ![dgpdx](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dgpdx](https://discourse.julialang.org/u/dgpdx)\
**Post date:** [August 20, 2021, 3:25pm UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/6 "2021-08-20T15:25:07Z")

</div>

Just using print works, thanks!

---

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [August 20, 2021, 3:58pm UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/7 "2021-08-20T15:58:19Z")

</div>

You may want to look at `Base.prompt`:

```julia
julia> msg = Base.prompt("Type something");
Type something: Hello!

julia> msg
"Hello!"

```

---

<div class="post-metadata">

**Author:** ![dgpdx](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@dgpdx](https://discourse.julialang.org/u/dgpdx)\
**Post date:** [August 20, 2021, 5:18pm UTC](https://discourse.julialang.org/t/printing-a-prompt-and-waiting-for-input/66696/8 "2021-08-20T17:18:55Z")

</div>

Thanks for the suggestion.
