简体   繁体   中英

VBA for loop with negative step, k, calling array(k+1). What will it do?

For k = kT To 0 Step -1
ThKC(k + 1) = ThKCl
.
.
.
next k

Suppose I have kT as 5000. ThkCl is a constant value. During the first iteration when I say (k+1), what will be the index of ThKC array?

I have no idea about VBA and need a script changed to python. So I'm just looking for the logic in the script. I also have the same script in Fortran90 too, but VBA seemed easier to understand. Any tips on the migration are also welcome.

Just guessing, that what you have in mind could be:

kT = 5000

For k = kT To 0 Step -1
    ThKC(k) = ThKCl
    ' Do other tasks.
Next

That would loop from 5000 to 0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM