Gets, etc (was RE: Newbie Questions)

Nobu wrote:
# Double Ctrl-D sends a text without a newline.

···

#
# > maybe, we can we have #gets2 or #input (for lack of better a
# > word) that automatically chops newline if there is one,
# > orthogonal to #puts putting one if there is none.
#
# a) use readline to input
# b) use Regexp to match

am sorry, i do not understand you clearly, Nobu. My dilemma is only on simple console/keyboard entry.

currently i do something like,

def input
   gets.strip
end

print "Enter Y or N : "
x = input.upcase

if x == "Y"
   puts "thank you..."
elsif x == "N"
   puts "i see.."
else
   puts "invalid input"
end

i think the function of input is more intuitive and less surprising to nubies. Also, is not that the reason w add newline on puts, no?

thank you for answering nuby questions.
kind regards -botp