请如何修复此AS3功能?
谢谢
function dispari(numero:int):Boolean;
{
//check if the number is odd or even
if (numero % 2 == 0)
{
returns false;
}
else
{
returns true;
}
}
错误:1071:语法错误:属性返回后,应使用定义关键字(例如function),而不是false。
为什么在函数语句末尾有分号(;)
?我没有做[[any AS3编码,但是看起来不正确,而且粗略浏览一下网络上的一些示例就没有了。
function dispari(numero:int):Boolean
{
//check if the number is odd or even
if (numero % 2 == 0)
{
return false;
}
else
{
return true;
}
}
我还更改了return
语句以匹配其他所有AS3的操作以返回值(谢谢,@ Herms,忘了提了:-)
function dispari(numero:int):Boolean
{
return (numero % 2 != 0);
}