2007/11/13, Jigar Gosar <jigar.gosar / gmail.com>:
> def list base_dir, prefix
>   Dir.foreach(base_dir){|file|
>     if (file.eql? "." or file.eql? "..")
>       puts "break dosent work either"
>       break
>     end
>
>     # this if is the only solution i found, but its ugly.
>     if !(file.eql? "." or file.eql? "..")
>       puts "Got #{prefix+file.gsub(/.java$/,"")}" if file =~ /.*\.java$/
>       full_name = base_dir+"/"+file
>       if(File.directory?(full_name))
>         list full_name, prefix+file+"."
>       end
>     end
>   }
> end
>
> list "c:/java/", ""
>
> break not only exited the block but also prevented execution with the
> next file in the directory, break actually broke the foreach loop
> entirely, I just wanted something like continue :)
> please advise.

That would be "next".  Note that exiting from a block and switching to
the next iteration is something completely different.  You asked for
exiting and thusly were correctly referred to "break".

Cheers

robert

-- 
use.inject do |as, often| as.you_can - without end