From: Stu Date: 2011-04-22T17:16:51+09:00 Subject: Re: Reversing a string without using array, classes and reverse function Simple =) s = "1234567890" r=String.new i = 1; while i <= s.length r << s[-i] i+=1 end r == s.reverse true r is now the reverse of s On Thu, Apr 21, 2011 at 10:54 PM, Rubist Rohit wrote: > I am trying this: > > mystring = gets > mystring.scan(/..$/) {|x| puts x} > > It returns only the last character. Is it possible to add the above line > in loop? > > -- > Posted via http://www.ruby-forum.com/. > >