Message 1 of 8
how to test an empty array without getting error?

Not applicable
02-13-2001
08:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
...another dumb beginner question...
I have an array which may be empty but when I test it like
If array(0) = empty then
or
if array (0) = nothing then
etc
I get an error like subscript out of range or type mismatch,
so how do I check the contents of an array that may be empty so I can tell if it's safe to pass it to the function I want to use it in?
I've seen a lot of ...On error resume next...or on error go to... but I haven't quite absorbed the process fully, does the program just skip over the error condition and proceed with the next viable statement? I'm used to lisp just bombing and being unable to continue so this seems really weird!
Is that acceptable programming or just a flakey workaround for incorrectly structured code?
Thanks again for any help on this.
Mark
I have an array which may be empty but when I test it like
If array(0) = empty then
or
if array (0) = nothing then
etc
I get an error like subscript out of range or type mismatch,
so how do I check the contents of an array that may be empty so I can tell if it's safe to pass it to the function I want to use it in?
I've seen a lot of ...On error resume next...or on error go to... but I haven't quite absorbed the process fully, does the program just skip over the error condition and proceed with the next viable statement? I'm used to lisp just bombing and being unable to continue so this seems really weird!
Is that acceptable programming or just a flakey workaround for incorrectly structured code?
Thanks again for any help on this.
Mark