0

我在哪里犯错?

var mod;
    var module = ((from - to) % mod == 0);
    switch (mod)
    {
        case 20:
            for (i = 20; i <= to - from; i = i + 20)
            {
                //console.log("case");
                CanYou(i, from, to)
            }
            break;

    }

我很想切换条件,有人可以帮助我吗?我想找到一个(某些计算)模块等于0的数字;

4

2 回答 2

0

您的 mod 变量未定义。也许你想要切换模块变量?

var module = ((from - to) % mod == 0);
switch (module)
{
    case 20:
        for (i = 20; i <= to - from; i = i + 20)
        {
            //console.log("case");
            CanYou(i, from, to)
        }
        break;

}
于 2013-07-02T13:41:34.037 回答
0
var mod = 2; // need to init this to something
var module = ((from - to) % mod == 0);
switch (mod)
{
    case 20:
        for (i = 20; i <= to - from; i = i + 20)
        {
            //console.log("case");
            CanYou(i, from, to)
        }
        break;

}
于 2013-07-02T13:42:28.377 回答