Sha256: 90f2cd43f0de4b72767f48ff902eea4337af113e91e69a919c8c375e98e1fdf8

Contents?: true

Size: 393 Bytes

Versions: 1

Compression:

Stored size: 393 Bytes

Contents

# trapping_eof.rb
#
#  Created by James Edward Gray II on 2006-02-20.
#  Copyright 2006 Gray Productions. All rights reserved.

require "rubygems"
require "highline/import"

loop do
  begin
    name = ask("What's your name?")
    break if name == "exit"
    puts "Hello, #{name}!"
  rescue EOFError  # HighLine throws this if @input.eof?
    break
  end
end

puts "Goodbye, dear friend."
exit

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
highline-sgonyea-1.6.12 examples/trapping_eof.rb