Blu*_*men 3 java syntax processing conditional-statements
这让我疯了,因为它完全违反了我去除它的努力:
int k = keyCode; //keyCode being a variable declared by a keyPress
//in the Processing library
//k and keyCode are working properly.
if ((k - UP)*500 == 0); //int UP=38;
{
println((k-UP)*500 == 0);
//some other code here
}
Run Code Online (Sandbox Code Playgroud)
结果?"false"(并删除'== 0',一个非0的数字).据我所知,只有当你使用箭头键(k == 37,38,39,40; 38为UP)才能使这个条件成立.
有没有这样的不一致,可能是什么原因导致的?(条件的奇怪格式是因为它解决了类似的问题,RIGHT键无法正常工作,只有k == RIGHT).
| 归档时间: |
|
| 查看次数: |
166 次 |
| 最近记录: |