As you may recall, strings are immutable and the generator find() is working
on the string that it was passed, not some new string that has been assigned
to that same variable later on.  In an "every", find() is not called again,
so astring is not being re-evaluated each time through the loop -- the
call-in-progress is resumed where it left off.

Clint

On Wed, Jul 21, 2010 at 1:40 PM, Steve Graham <[email protected]
> wrote:

> procedure test()
>    astring := "honolulu"
>    write("astring=",astring)
>    every fnd := find("lu",astring) do {
>       write("fnd=",fnd)
>       astring[fnd:fnd+2] := ""
>       write("astring=",astring)
>       write()
>       astring := astring
>       }
>    write("End: astring=",astring)
> end
>
> Invoking this from main() gives the following output:
>
> astring=honolulu
> fnd=5
> astring=honolu
>
> fnd=7
> astring=honolu
>
> End: astring=honolu
>
> I would have thought that it would have given a value of fnd=5 twice.  What
> am I missing?
>
>
> Steve
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Unicon-group mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/unicon-group
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to