|
-
Mar 7th, 2001, 12:27 PM
#1
Thread Starter
Addicted Member
If I have a for loop with a function in it
For i = 0 to ubound(myarray)
'code
next
does vb have to call the function every time it loops, or does it store the value of the call in memory?
Thanks.
That which does not kill us, only makes us stronger. 
-
Mar 7th, 2001, 12:30 PM
#2
will call it everytime. same with any other loop.
-
Mar 7th, 2001, 12:33 PM
#3
Lively Member
It calls it everytime which gives u the ability to send a diff value to the function everytime (As shown below) - If the value of your function isnt going to change call it before your loop
For i = 0 to ubound(myarray)
Call FunctionName(i)
next
-
Mar 7th, 2001, 12:35 PM
#4
Thread Starter
Addicted Member
Thats what I thought, but the debugger never goes to that line once it enters the loop, so that made me begin to question it.
Thanks!!!
That which does not kill us, only makes us stronger. 
-
Mar 7th, 2001, 12:35 PM
#5
Frenzied Member
If you want to save some time
code with a stored variable
Code:
Dim ub As Integer
ub = UBound(myarray)
For I = 0 To ub
Call FunctionName(I)
Next
'Code improved by vBulletin Tool (Save as...)
Last edited by Evan; Mar 7th, 2001 at 12:39 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|