#1
  1. No Profile Picture
    Average Intelligence
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2003
    Location
    Ohio/Chicago
    Posts
    678
    Rep Power
    12

    for each loop, grab next item


    for each item in A

    is there a way in this loop to grab item, do arithmatic, then grab the next element in the array without going through the loop agian? I want to do 2 at a time and just thought it would be nicer if there was a way rather than having to deal with an integer and checking whether it was odd or even...
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    792
    Code:
        For cnt = 0 To 10
            val1 = ary(cnt)
            cnt = cnt + 1
            If cnt <= 10 Then
                val2 = ary(cnt)
            End If
            MsgBox "Val(" & (cnt - 1) & ") = " & val1 & vbCrLf _
                & "Val(" & cnt & " = " & val2
        Next cnt
  4. #3
  5. No Profile Picture
    Average Intelligence
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2003
    Location
    Ohio/Chicago
    Posts
    678
    Rep Power
    12

    dear onslaught's help desk...


    Yea, after seeing that i feel kinda stupid, there's an array length attribute isn't there.... damnit

    i was thinking i had to use for each X in ARRAY, but i guess an even easier what would be the

    FOR cnt 0 to array.length-1
    blah
    cnt=cnt+1
    blah
    next cnt

    I did a split on a 2 column comma separated excel cvs file, so they'll always be in pairs

    but in anycase, i guess that means there isn't a way to do
    Array(item+1) for the FOR EACH method then huh?

IMN logo majestic logo threadwatch logo seochat tools logo