input()

The input() built-in function reads a line of text from the user via standard input (stdin). Useful for interactive programs and user prompts.

Syntax

input()              // Read without prompt
input("message")     // Show message, then read

Basic usage

let name = input("Enter your name: ");
print("Hello,", name);

Interactive example

class Calculator {
    print("Simple Calculator");
    
    let aStr = input("Enter first number: ");
    let bStr = input("Enter second number: ");
    
    // Note: input always returns strings
    // You would need to parse to int/float for math
    print("You entered:", aStr, "and", bStr);
}

Without prompt

Call input() without arguments to read silently:

let secret = input();
print("You typed:", secret);

Return value

Always returns a string. The trailing newline is stripped. To convert to numbers, you would need to implement parsing functions (coming in future versions).