要删除的警告: [英] want to remove warnings:

查看:164
本文介绍了要删除的警告:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在面临一个问题,因为重复的变量定义而编制,但它并没有完全实现我的计划。

I am facing a problem as Duplicate variable definition while compiling but it is not at all effecting my program.

有没有什么办法可以消除编译器错误东阳它每次快到的时候我跑的电影。

Is there any way to remove compiler errors beacause it is coming every time when i run movie.

推荐答案

删除重复的变量定义。我怀疑,你正在做类似如下:

Remove the duplicate variable definition. I suspect that you are doing something like the following:

function foo() : void {
    for(var i:uint=0; i<10; i++) {
        // do stuff in here
    } 
    for(var i:uint=0; i<10; i++) {
        // do stuff in here
    }
}  

这会抱怨在编译重复的变量定义,因为你已经得到了我两个定义。在编译过程中,动作做什么是所谓的可变悬挂。这意味着,所有的变量声明被移动到函数的顶部。 (我不知道为什么它这样做),如果您在第二个循环如下所示,警告将消失:

This will complain about duplicate variable definitions at compilation because you've got two definitions of i. During compilation, actionscript does what's called "variable hoisting". It means that all variables declarations are moved to the top of the function. (I don't know exactly why it does this) If you make the second loop look like the following, the warning will go away:

for(i=0; i<10; i++) {
    // do stuff here
}

这篇关于要删除的警告:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆