Having this as refrence:
VB Code:
  1. Dim i as integer
  2. For i=0 to 1000
  3. 'Some code here
  4. Next
Which one of the following will run faster? any as fast as the above?
1:
VB Code:
  1. Dim i as Integer, J as Integer=1000
  2. For i=0 to J
  3. 'Some code with no change in J value
  4. Next
2:
VB Code:
  1. Dim i as Integer, J as Integer=2000
  2. For i=0 to J/2 ' Or any other operation on J
  3. 'Some code with no change in J value
  4. Next
3:
VB Code:
  1. Dim i as Integer
  2. Const J as Integer=1000
  3. For i=0 to J
  4. 'Some code with no change in J value
  5. Next
4:
VB Code:
  1. Dim i as Integer
  2. Const J as Integer=2000
  3. For i=0 to J/2 'or any other operation on J
  4. 'Some code with no change in J value
  5. Next