readLine

Reads a single line from standard input and returns it as a string, with the trailing newline stripped. An optional prompt is written to standard error before reading. Intended for interactive/CLI use.

readLine([prompt]) → returns string

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

prompt string

Optional prompt text written to stderr before reading.

Examples
Sample code invoking the readLine function

Prompt for a name and echo it back.

name = readLine("Name: ");
writeOutput("Hello, #name#");

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub