Learn R Programming

sketch (version 1.1.20.3)

read_multilines: Read one or more lines from the console for the first successful parse

Description

read_multilines reads one or more lines from the terminal (in interactive use).

Usage

read_multilines(prompt = "")

Arguments

prompt

the string printed when prompting the user for input. Should usually end with a space " ".

Details

This function repeatedly calls readline until enough inputs are provided to reach a successful parse.

This can only be used in an interactive session.

Examples

Run this code
if (FALSE) {
# In an interactive session
read_multilines()
1 + 2  # expect immediate success

read_multilines()
1 +
2 +
3  # expect success here
}

Run the code above in your browser using DataLab