From: Martin Kahlert Date: 2001-12-05T15:49:15+09:00 Subject: [ruby-talk:27523] Re: I don't understand this Hi Vincent! On Wed, Dec 05, 2001 at 04:11:45AM +0900, Vincent Foley wrote: > OK, help me here. Here's a small piece of code: > [code] > > #!/usr/bin/env ruby > > phrase = gets.chomp > > l = phrase.length > > l.downto(0) {|x| > print phrase[x,1] > } > #puts > [/code] > > Notice that 'puts' on the last line is commented. If I leave it > commented, nothing will output, if I uncomment it, then my string will > be displayed. Anyone could enlighten me? As others already pointed out you got bitten by a non flushed output stream. Nevertheless, shouldn't the line 'l = phrase.length' be 'l = phrase.length-1'? Bye, Martin. -- The early bird catches the worm. If you want something else for breakfast, get up later.