From: Dark Ambient Date: 2006-07-03T21:49:31+09:00 Subject: Re: if problem in loop causing weirdness Break doesn't seem to be the solution. To jump ahead to the behaviour, when asked if I want to overwrite, if answer is no, then everything behaves properly. If yes, which is covered in the else portion following 'get', it asks me 4x (there are 5 files in the directory I'm using. I've tried 'break' in various places (where it might have made sense) but didn't seem to correct the behaviour. Stuart On 7/3/06, Nuralanur@aol.com wrote: > You can use the break command to stop iterating through a block, eg. > (simplifying your commands a bit): > > file_names=['a.txt','b.txt','c.txt'] > file_names.each do |x| > if x=='b.txt' > puts 'we already have ' + x + ' in that array ' > break > end > end > > Best regards, > > Axel > >