简体   繁体   English

VBA for 循环,负步长 k,调用数组 (k+1)。 它会做什么?

[英]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.假设我的 kT 为 5000。ThkCl 是一个常数值。 During the first iteration when I say (k+1), what will be the index of ThKC array?在第一次迭代中,当我说 (k+1) 时,ThKC 数组的索引是多少?

I have no idea about VBA and need a script changed to python.我对 VBA 一无所知,需要将脚本更改为 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.我在 Fortran90 中也有相同的脚本,但 VBA 似乎更容易理解。 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.那将从 5000 循环到 0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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