|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
HI all,
is there anyway to skip numbers in a for...next statement?? is there such a thing: for i = 1 to 100, skip 10 i need to just skip a particular number or a small group of numbers.....i can very well use many if statement.. but it'll take up too much processing time.... any ideas?? |
|
#2
|
||||
|
||||
|
Not that I know of, but an if statment is hardly resource intensive.
In fact if there were a way to do it then it would still construct an If Then statment implicitly, in the same way as Dim x As New Object creates If x = Nothing then x = New Object statments. |
|
#3
|
|||
|
|||
|
Yes there is a way, actually your code is almost there, here is the code:
For i=0 to 100 step 10 print i next i |
|
#4
|
|||
|
|||
|
Skip some number without If statement??U can load the numbers to a array,and read the number of the array to process.With doing so,U can use for statement without if statement to judge..
|
|
#5
|
|||
|
|||
|
no no no.....
-_-" i need to skip only .. lets say...52??? |
|
#6
|
|||
|
|||
|
You could exclude a count programmatically.
Code:
For i = 0 to 100
If i <> 52 then
'Do stuff here
End If
Next
|
|
#7
|
|||
|
|||
|
sure...
thanks.. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > for...next help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|