Mojo function
input
input(prompt: String = "") -> String
Reads a line of input from the user.
Reads a line from standard input, converts it to a string, and returns that string. If the prompt argument is present, it is written to standard output without a trailing newline.
Examples:
name = input("Enter your name: ")
print("Hello", name)
name = input("Enter your name: ")
print("Hello", name)
If the user enters "Mojo" it prints "Hello Mojo".
Args:
- βprompt (
String
): An optional string to be printed before reading input.
Returns:
A string containing the line read from the user input.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
π What went wrong?