> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/r/readline_interface.md).

# Readline interface

```ruby
require('Term::ReadLine')

var term = %O<Term::ReadLine>.new('Example')

term.addhistory('foo')
term.addhistory('bar')

loop {
    var cmd = term.readline("Prompt: ") \\ break

    if (cmd ~~ %w[q quit]) {
        break
    }

    say "You inserted <<#{cmd}>>"
}
```
