Current location: Hot Scripts Forums » Programming Languages » ASP » For ... Next loops


For ... Next loops

Reply
  #1 (permalink)  
Old 11-13-08, 06:24 AM
rb1982 rb1982 is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
For ... Next loops

If i have stored items in an array named 'StoredI' and the array has been enlarged several times due to executing script. How would I be able to loop through the entire array?

the variable declared is 'intLoop and also the variable 'varMax' is the value of the largest element of the array.


I have done

For intLoop = 1 to UBound (StoredI (varMax))
Reply With Quote
  #2 (permalink)  
Old 11-13-08, 10:56 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Is it a 1-dimensional array?

If yes:

Code:
For i = 0 to UBound(StoredI)    
   Response.Write(StoredI(i))    
Next
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #3 (permalink)  
Old 11-13-08, 03:54 PM
rb1982 rb1982 is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
yes it is 1dimensional...but why do i not put varMax in?

thank you
Reply With Quote
  #4 (permalink)  
Old 11-18-08, 02:29 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
If you mean that varMax is the size of the array, then it is not neccesary. Ubound gives the size of array too:

If StoredI has 10 elements then

For i = 0 to Ubound(StoredI)

Is the same as

For i = 0 to 9
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
nested loops.. need some help with printing asterisks please.. zayin Everything Java 4 04-27-10 12:53 AM
Flash Video Loops HornedSheep Flash & ActionScript 1 10-13-06 07:53 PM
nested while loops "running away" lordmerlin PHP 6 01-04-06 04:24 AM
VB Help NEEDED ON Branching, Loops and Subroutines Jerome The Lounge 0 12-01-03 07:55 AM
Branching, Loops and Subroutines HELP NEEDED Jerome Visual Basic 0 11-30-03 09:55 AM


All times are GMT -5. The time now is 04:04 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.