主题:  关于数组的问题

gimy

职务:普通成员
等级:1
金币:0.0
发贴:8
注册:2002/8/4 11:45:02
#12003/5/12 10:45:32
CFMX环境:

我定义了一数组。
想用IsDefined去测试其中一个元素是否存在。
但是不行。

后来查ref,说The IsDefined function does not test the existence of array elements. To test whether data exists at an array index, copy the array element to a simple variable and use the IsDefined function to test the existence of the copy.

所以,定义一个变量check




但是如果myArray[3]是没定义的。则就会报错。这样还是不能达到原来的目的。

请问有什么办法可以判断数组其中一个元素是否存在呢?

谢谢。



s22

职务:版主
等级:4
金币:10.0
发贴:1634
注册:2004/12/19 13:06:46
#22003/5/28 23:39:18
用个愚蠢的TRY就可以了



wait

职务:普通成员
等级:1
金币:10.0
发贴:220
注册:2002/10/19 11:02:36
#32003/5/29 6:49:08
是你自己用法错了,