Skip to content

Commit

Permalink
[docs] Add an example to the Base.prompt docstring (JuliaLang#43638)
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored Jan 3, 2022
1 parent fa63a00 commit fbe37e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@ is encountered or EOF (^D) character is entered on a blank line. If a `default`
then the user can enter just a newline character to select the `default`.
See also `Base.getpass` and `Base.winprompt` for secure entry of passwords.
# Example
```julia-repl
julia> your_name = Base.prompt("Enter your name");
Enter your name: Logan
julia> your_name
"Logan"
```
"""
function prompt(input::IO, output::IO, message::AbstractString; default::AbstractString="")
msg = !isempty(default) ? "$message [$default]: " : "$message: "
Expand Down

0 comments on commit fbe37e1

Please sign in to comment.