简单的问题,当空隙如下函数在AS3它在干什么?
公共职能sayGoodbye():无效{跟踪(再见从MySubClass);}
解决方案
无效
类型指示给你写的函数不会返回任何值,在编译器如果你指出除无效编译器期望返回牛逼其他类型T对方。
例如:
函数foo(一:INT):INT {//这里编译器期望的地方
//在函数返回一个int
返回;
}
Simple question here, when void follows a function in AS3 what is it doing?
public function sayGoodbye():void { trace("Goodbye from MySubClass");}
解决方案
void
type indicates to the compiler that the function you have written will not return any value, in the other side if you indicate other type T than void the compiler expect that you return T.
Ex:
function foo(a:int):int { // here the compiler expect that somewhere
// in your function you return an int
return a;
}