Skip to content

Commit dae2df3

Browse files
[DOC] New document "For Users" (#856)
1 parent 12de2b0 commit dae2df3

2 files changed

Lines changed: 676 additions & 0 deletions

File tree

doc/echo.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require 'reline'
2+
3+
puts 'Welcome to the Echo program!'
4+
puts ' To exit, type Ctrl-d in empty line.'
5+
6+
# Words for completion.
7+
Words = %w[ foo_foo foo_bar foo_baz qux ]
8+
Reline.completion_proc = proc { |word| Words }
9+
10+
# REPL (Read-Evaluate-Print Loop).
11+
while line = Reline.readline(prompt = 'echo> ', history = true)
12+
puts "You typed: '#{line.chomp}'."
13+
end

0 commit comments

Comments
 (0)