Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
arrays
#11
Quote:Having it inside the loop slows it down a little. What he's saying is it's better to have to outside the loop...

...because you're just doing the same equation 6 times, when it only needs to be done once. If it was
Code:
FOR i = 1 TO 6
num(i) = i
PRINT num(i)
NEXT
then that would be fine, because you're changing 6 different variables to 6 different values. Even if it was just
Code:
num(4) = i
or
Code:
num(i) = 3
I'd still say it's okay to do, because at least one value in the equation is the variable that's changing 6 times. But
Code:
num(2) = 3
is just plain bad to put *inside* a loop, because it only needs to be done once (because nothing in the equation is changing).
earn.
Reply
#12
pretend you're the teacher and QB is the student. the student'd be pissed if you made him do the same damn thing six times.
ammit potato!
Reply
#13
Quote:pretend you're the teacher and QB is the student. the student'd be pissed if you made him do the same damn thing six times.

:lol: Very good analogy Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)