lrc123 发表于 2007-7-29 20:18:27

[求助]怎样在if else分支中并列两个表达式呢?

怎样在if else分支中并列两个表达式呢?就是要同时满足两个条件才判断为true
if (player_health > 0)
{
    if (ammo > 0)
    {
      fire_bullets();
    }
}

就象这样,把两个if合成一个if,有这个可能吗?

ultranet 发表于 2007-7-29 21:42:25

if (player_health > 0 && ammo > 0)
{
      fire_bullets();
}
页: [1]
查看完整版本: [求助]怎样在if else分支中并列两个表达式呢?