Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sat Nov 18, 2017 8:50 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Array length ?
PostPosted: Fri Jun 17, 2011 3:47 am 
Offline

Joined: Wed Jun 15, 2011 12:14 am
Posts: 28
I want to know if it is possible to check or control an array's size to avoid errors in code before using this array.
How can I check the array's size ?

I am searching something like: if array.length > 0 then....

Thanks !


Top
 Profile  
 
 Post subject: Re: Array length ?
PostPosted: Mon Jun 20, 2011 6:25 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Code:
if len(array) >= 5 then
    array[4] = 9
endif


Depending on what you are doing there are other reasonable approaches
Code:
redim(array, 5)
array[4] = 7


Code:
check error
    array[4] = 5
on error
    _ClearException()
enderr

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Array length ?
PostPosted: Mon Jun 20, 2011 9:41 am 
Offline

Joined: Wed Jun 15, 2011 12:14 am
Posts: 28
Thanks a lot, it really works !
I am so grateful for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group