Re: haha very funny

new topic     » goto parent     » topic index » view thread      » older message » newer message

euman at bellsouth.net wrote:

> d = dir(current_dir()) -- this says right up front dir( ) returns a
sequence doesnt it!

Well, not really. It returns a sequence _if_ the routine succeeds. If
not, it returns an integer. So you can write your test:

   object d
   d = dir( ... )
   if integer( d ) then
      ... failure code
   else
      ... success code
   end if

or use 'not sequence(d)' if you prefer. It's idiomatic to Euphoria, and
shows up in a number of places. For example:

   while 1 do
      result = gets( handle )
      if integer( handle ) then
         exit
      end if
   end while

I'll grant that it's a bit odd, but it's more or less consistant.

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu