Are they the same, or are there subtle differences between the two commands?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
getswill useKernel#gets, which first tries to read the contents of files passed in throughARGV. If there are no files inARGV, it will use standard input instead (at which point it’s the same asSTDIN.gets.Note: As echristopherson pointed out,
Kernel#getswill actually fall back to$stdin, notSTDIN. However, unless you assign$stdinto a different input stream, it will be identical toSTDINby default.http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-gets