On Wed, Jul 31, 2002 at 01:53:37AM +0900, ts wrote:
>  Do you accept to have 3 characters rather than 2 ?
> 
> M>     FileTest.directory?(dir) -> raise "Directory #{dir} already exists."
> 
>        FileTest.directory?(dir) and raise "Directory #{dir} already exits"

Thanks to you, to Martin and to Hal for your suggestions.  Yes, three
characters rather than two is fine. :-)

My mind has trouble parsing it, though; it goes `well, this and that
what?'

Just out of curiosity, anyway, this is what I had came up with:

class Object
  def then
    yield if self
  end
end

FileTest.exists?('/etc/passwd').then { puts "exists" }

scream = proc { puts "ayeeee!" }

FileTest.exists?('/mnt/windows').then &scream



Massimiliano