开发者

In VB for loops is less that or greater than allowed?

开发者 https://www.devze.com 2023-03-16 23:00 出处:网络
eg code For lLngIndex = 0 To lLngIndex < 256 Step 1 lBytKeyAry(lLngIndex) = Val(pStrKey((lLngIndex Mod lLngKeyLength)))

eg code

        For lLngIndex = 0 To lLngIndex < 256 Step 1
            lBytKeyAry(lLngIndex) = Val(pStrKey((lLngIndex Mod lLngKeyLength)))
        Next

is lLngIndex < 256 allowed?

when I debug code and go step by s开发者_StackOverflowtep it seems to always skip the for loops


The correct code for loop:

For lLngIndex = 0 To 255
    lBytKeyAry(lLngIndex) = Val(pStrKey((lLngIndex Mod lLngKeyLength)))
Next

NOTE: No need for step 1 because step 1 is the default value

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号