From fbe37e1aab969ca68af129345aab7c883937aba6 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Mon, 3 Jan 2022 06:17:36 -0500 Subject: [PATCH] [docs] Add an example to the `Base.prompt` docstring (#43638) --- base/util.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/base/util.jl b/base/util.jl index 6bc9b0da47842..c9f0e82e42c55 100644 --- a/base/util.jl +++ b/base/util.jl @@ -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: "