1. RE: booleans

I treat all variable names as 'holders' of a sort.
They dont actually hold anything untill you give them something to hold.
If i understand you correctly, your looking for a method to
check if the variable has been assigned a value yet within the
program.  For some reason or another, the syntax checker does
this, but there isnt a user function to do this.  That said,
i would also say you might try initializing all your variables
if you are in the habit of testing their state very often.
A sequence would therefore be initialized with ""
and an atom or integer with a 0 (numerical zero).
Ive run into this kind of thing a lot too, and that got me into the
habit of intializing a lot of my variables early on in the program
with the null value for that kind of variable so that testing later
doesnt produce a run time error in any case.
For objects you will have to decide what to use as an intializer.

Good luck with it.
--Al

new topic     » topic index » view message » categorize

2. RE: booleans

On 5 Feb 2001, at 1:07, Al Getz wrote:


> A sequence would therefore be initialized with ""

But i DID that

Kat

new topic     » goto parent     » topic index » view message » categorize

3. RE: booleans

I think there must be an error in your code..

I tested what you explained, and it works for me..
Though "if (result="") then".. doesn't work on sequences

Here's my test code..

< CODE >
object Result   Result=""

-- if ( Result="" ) then
   if ( equal(Result,"") ) then
     printf(1,"%s",{"Worked"})
   end if
-- end if
< END OF CODE >

Perhaps the assignment isn't read by the interpretter until after the if 
structures? Or is your code inline?

Chris

Kat wrote:
> Here is an example of the trouble i have with Eu's comparisons:
> 
> result = ""
> -- i had to give it "", or else "&=" gives an error getlost
> -- code doing things, but not changing result
> 
> if ( result = "" ) then
> if equal(result,"") then
> 
> both "if" statements give the same result:
> 
> variable result has not been assigned a value 
> 
> So what i want to know is: how do i find out if result is still empty? 
> length() is the only 
> way? Ack!
> 
> Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu