Re: seq errors

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

----- Original Message -----
From: Bernie Ryan <bwryan at PCOM.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, December 31, 1999 2:24 PM
Subject: Re: seq errors


> On Fri, 31 Dec 1999 10:30:39 -0600, Kat <KSMiTH at PELL.NET> wrote:
>
> >I have another suggestion.... in a 141 line program, i have this:
> >In this way,
> >
> >sequence line
> >if equal("?",line[0]) then
> >  DoSomething
> >end if
> >
>
>
> -- define a empty string
> type empty( sequence string )
>   if length(string) then return 0 else return 1 end if
> end type
>
> --
> sequence line
>
> --
> line = "this is the string"
>
>
> if empty(line) then
>   -- do something
>   ? 123
>   ? length(line)
> end if
>
>
> if not empty(line) then
>   -- do something
>   ? 456
>   ? length(line)
> end if
>
>
> -- Kat: You can do this, which is less confusing and you will be able to
> --      keep track of things easier so you don't crash.

I guess i didn't make myself clear again, i am not trying to test for empty
sequences, i have vars in place of the 0, :

for loop = 1 to length(textword) do
-- morecode
-- code that may set textword to ""
 if (length(textword) > 0) and not ((( textword[loop] >= 'a' ) and
 textword[loop] <= 'z' )) or (( textword[loop] >= 'A' ) and
 textword[loop] <= 'Z' ))) then
-- code that may set textword to ""
-- morecode
end for

If loop gets set to zero without the length test, it crashes, so i test for
zero length with every test, cause who knows what is in the file the code is
processing? If instead Eu returned "" or false, the rest of the line would
fail without crashing, and the numerous length tests wouldn't be necessary.

Kat

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

Search



Quick Links

User menu

Not signed in.

Misc Menu