Hello,
Say, I am taking an input from user via the statement: print "Type here"
Then what should I do to reverse the phrase? How can I assign the input into
a variable and then issue the method .reverse?
Peace be upon you -
Junayeed Ahnaf Nirjhor
Twitter - @Nirjhor <http://twitter.com/nirjhor>
Take a look at the gets method:
http://rdoc.info/stdlib/core/1.8.7/Kernel:gets
-Jeremy
···
On 10/14/2011 09:03, Junayeed Ahnaf Nirjhor wrote:
Hello,
Say, I am taking an input from user via the statement: print "Type here"
Then what should I do to reverse the phrase? How can I assign the input into
a variable and then issue the method .reverse?
try mystring.reverse, i.e.
mystring=gets
newstring=mystring.reverse
···
--
Posted via http://www.ruby-forum.com/.