Answer the question
In order to leave comments, you need to log in
How to make sure that out of several conditions only one suitable one is met?
I wrote this code:
if (num1 == 1 && num11 ==1){
alert ('тест1');
}
if (num2 == 1 && num11 == 1){
alert('тест2');
}
Answer the question
In order to leave comments, you need to log in
if (Input.GetKeyDown ("E") ) //метод возвращает bool - в с# его нельзя сравнивать с 0
{
Guns += 1;
}
if (Input.GetKeyDown ("Q") ) //В чём ошибка?
{
Guns -= 1;
}
if (num1 == 1 && num11 ==1 && num2 != 1){
alert ('тест1');
}
if (num2 == 1 && num11 == 1 && num1 != 1){
alert('тест2');
}
if (num1 == 1 && num11 == 1){
alert ('тест1');
} else if (num2 == 1 && num11 == 1){
alert('тест2');
}
If you have num1 equal to 1 and num2 not equal to 1, then there will be no two alerts.
Well, yes - ===, not ==.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question