Re: booleans

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

Hi Kat,
I do this sort of thing all the time, and it works just fine.
eg.
   sequence result result = ""

Of course, it would be neater if one could do ...

  sequence result = ""

but RDS does not believe in that particular 'heresy'.

One possible problem that you might have is this type of coding...

  sequence result
  result = ""

  procedure xyz()
     sequence result

     if length(result) = 0 then ...

  end procedure

here we have the identifier 'result' defined twice, once as a file-scoped
variable and another as a procedure-scoped variable. The procedure one is
being tested but the file one is being initialised.

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: <EUforum at topica.com>
Sent: Tuesday, February 06, 2001 6:39 PM
Subject: Re: booleans


> On 5 Feb 2001, at 1:09, Igor Kachan wrote:
>
> > Dear Kat:
> >
> > > No, because length() gives the same error,
> > > result has no value!
> >
> > Try please:
> >
> > ---------
> > sequence s
> > s={}
> > ? length(s)
> >
> > sequence t
> > t=""
> > ? length(t)
> > ---------
>
> Ok, i declared
> result = {}
> and with
> result = ""
> and both died at the same place
> if ( length(result) = 0 )
> with the same error:
> variable result has not been assigned a value
>
> ex.err has this:
>  result = <no value>
>
> Changing result from a sequence to an object didn't help.
>
> Neither did
> if ( result = "" ) then <-- same error
> neither did:
> if equal(result,"") then <-- same error
> neither did:
> if compare(result,"") then <-- same error
> neither did:
> if match(result,"") then <-- same error
>
> I even checked ex.err trace to verify i had saved the new lines after
editing them, to
> make sure i was running the code i thought i was!
>
> Robert, how do i do this?
>
> result = "" -- only so the &= operator will work getlost
> -- misc code that doesn't change result in this pass
> --now how to tell if result is still "" or not?
>
> Kat,
> wringing her paws,
> recoding with:
> result = "-1" -- cause it will never be this, i hope
> -- code modified to not use the &= ,
> -- but instead to replace result if "-1"
> -- and &= if not "-1"
> -- then check if result = "-1"
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu