Is it more efficient to assign a list size to variable instead of frequently using N Items function?Hi,
I frequently use the size of user-input lists to end "for loops." I usually just use
For (i=1, i<=Nitems(list), i++,
"Blah Blah"
)
If I have many for loops, is it more efficient to declare A=Nitems(list) and call this variable in all my for loops?
Thanks.
Re: Is it more efficient to assign a list size to variable instead of frequently using N Items functThanks! It was just a question out of curiosity. Thanks for teaching me about Tick Seconds() and HP Time().
It's good to learn something new.
Re: Is it more efficient to assign a list size to variable instead of frequently using N Items functIt will be more efficient to store the result from the first function call than to call the function again. On the other hand, I rarely bother because the script is often so fast it is not worth the savings.
You can profile your code by calling Tick Seconds() or HP Time() before and after your test code and examine the difference in time.