有人可以解释这段代码有什么问题吗?对我来说它看起来不错,但它一直说表达式的开头是非法的,并且 {} 是预期的,即使它在那里。
if (gamestate = 1) {
while (life > 0) {
if (atk > enemydef) {
atk1 = atk - enemydef;
enemylife = enemylife - atk1;
System.in.println("Enemy health: " + enemylife);
System.in.println("Your Health" + life);
}
if else(atk<enemydef) {
enemylife = enemylife;
} else {
enemylife = enemylife;
}
}
else {
System.out.println("GAME OVER");
}