# Re: gets, etc (was RE: Newbie Questions)

**URL:** <https://www.ruby-forum.com/t/re-gets-etc-was-re-newbie-questions/64322>\
**Category:** Ruby\
**Created:** [June 24, 2006, 6:27am UTC](https://www.ruby-forum.com/t/re-gets-etc-was-re-newbie-questions/64322 "2006-06-24T06:27:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [June 24, 2006, 6:27am UTC](https://www.ruby-forum.com/t/re-gets-etc-was-re-newbie-questions/64322/1 "2006-06-24T06:27:57Z")

</div>

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
