problem with for...in

Sam DeVore sdevore at cliffhanger.com
Sun Nov 3 09:05:09 PST 2002


I always check the size of the table before I loop though it

like
if sizeOf(myTable) > 0
	for adr in myTable
		//code inserted here
else
	//code inserted here


sam d
On Sunday, November 3, 2002, at 09:56  AM, Jan M.J. Storms wrote:

> 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?
>
>
=======
See a new experiment: a dad and his two girls
http://scidzone.editthispage.com
join, see and share......
=======
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1030 bytes
Desc: not available
Url : http://lists.userland.com/pipermail/frontier-users/attachments/20021103/7af31d76/attachment-0002.bin


More information about the Frontier-Users mailing list