problem with for...in
David A. Bayly
dbayly at udena.ch
Sun Nov 3 09:04:28 PST 2002
This is an old and annoying glitch. You get item#1 when you open the
table in the IDE, perhaps there are other circumstances too, but
that's the major one.
One work-around better than testing in the loop.
try {delete(@myTable.["item #1"])}
for adr in myTable {
adr^.myValue = "this string"}
>I have the following problem with iterate thru tables:
>
>for adr in myTable {
> adr^.myValue = "this string"}
>
>will give me an error if myTable is empty. It complains that there is no
>item "item #1". If I check for the size of adr^ it tells me that it can't
>get the size of adr^. If i check for the name of adr^ it returns "item #1".
>
>I think that if I do a for..in loop on a table that is empty the for...in
>loop should not be executed.
>
>A workaround at this time could be:
>
>for adr in myTable {
> try {
> sizeOf (adr^)}
> else {
> adr^.myValue = "this string"}}
>
>Is this something to be fixed?
--
- David Bayly. Programmer and digest reader. dbayly at udena dot ch
Digest Readers do it once a day.
More information about the Frontier-Users
mailing list