Re: re-eval loops

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

Matt Lewis wrote:

> Matt,
> 
> A suggestion/request to make a difference from Eu:
> 
> for urlloop1 = 1 to length(newsurls) do
> 
> 
> I again got bit by the length() being evaluated only once, and  not 
each time the line
> is run over. In my case, i add to the nested sequence newsurls, so it 
properly
> should grow as the program runs. But the length is tested only once, 
and locks
> in the preliminary value, so the db isn't growing. This is something 
i often
> haveto get around somehow.

Luckily, with goto, i can now get past this headache in several ways, 
of *my* choosing. I easily recoded the for-loop (while-loop was as bad) to be a
repeat-until loop (which Eu doesn't have), with *all* the important loop vars
evaluated on *every* loop. I now have the following, and it runs nicely.
-- loop thru them --

if length(newsurls) then -- got any?
--for urlloop1 = 1 to length(newsurls) do -- this bites

  urlloop1 = 1 -- do it manually, got at least 1 if we got this far
  :"loopnewsurls" -- we can loop back to here

  == munging code goes here  ==

  -- the following is a repeat-until loop!
  if urlloop1 < length(newsurls) then -- reached the end yet?
    urlloop1 += 1 -- nope, there's more, so increment
    goto "loopnewsurls" -- and loop up to the next index
  end if -- urlloop1 < length(newsurls) then

--end for --urlloop1 = 1 to length(newsurls) do -- this bites
end if -- if length(newsurls) then -- got any?


Vincent wrote:

> Hi there... I don't think there needs to be any more loop methods. 
> "while" and "for" are good enough.

I asked for "repeat-until" loops in the past, and RDS declined. I asked for
"goto" so i can make my own, and RDS declined.

All praise to "goto" for ease of coding around bugs, idiosyncrasies, 
and making *simple* and basic structures that don't exist in RDS's Eu!

Kat

<[ This message has been forwarded by Vincent on behalf of Kat. ]>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu