Instance Method
ask(_:isSecure:)
Requests input from the console after displaying a prompt.
func ask(_ prompt: ConsoleText, isSecure: Bool = false) -> String
Parameters
promptText to display before asking for input.
isSecureSee
input(isSecure:)
Return Value
Input String. entered in response to the prompt.
Discussion
let answer = console.ask("How are you doing?")
console.output("You said: " + answer.consoleText())
Input will be read until the first newline. See input(isSecure:). The above code outputs:
How are you doing?
> great!
You said: great!