如何实现循环IronPython

本文关键字:循环 IronPython 实现 何实现 | 更新日期: 2023-09-27 18:22:05

如何在IronPython中实现循环的C#,我似乎找不到在IronPython 中实现i - 10的方法

        int amount = 32;
        int scrolls = 0;
        int mets = 0;
        if (amount >= 10) {
            for (int i = amount; i >= 10; i -= 10) {
                scrolls++;
                if (i - 10 < 10)
                    mets = i - 10;
            }
        }

如何实现循环IronPython

您的循环退出条件是i >= 10。循环进入条件为amount >= 10i被设置为循环条目上的amount,该条目已经是>= 10。您的循环将永远不会执行。