IO
input
Property | Details |
---|---|
Function | input(prompt) |
Description | Reads a line of input from the user. If a prompt string is provided, it is displayed before reading input. |
Parameters | prompt (optional, string) – The text to display before waiting for input. |
Return Type | string (the user's input) |
Errors | Throws an error if more than one argument is provided. |
Example | input("Enter your name: ") → Displays Enter your name: and waits for input.input() → Waits for input with no prompt. |
print/println
Property | Details |
---|---|
Function | print(args...) , println(args...) |
Description | Prints one or more arguments as a single concatenated string. println appends a newline at the end. |
Parameters | args... (any type) – One or more values to print. |
Return Type | None |
Errors | None. |
Example | print("Hello, ", "world!") → Prints Hello, world! println("Hello") → Prints Hello followed by a newline. |