I've inverted the conditions and switch code A with code B and it works as it should, awesome!
If statement with multiple conditions
Heyo, I have two conditions in one if statement.
I'm focusing on number of tries: If number of tries is still higher than 0, execute code A (positive code), but if it's 0 or lower, execute code dB (negative code)
Second condition is length: If current length is lower than set length (from variable), execute coda A, if it's higher or same as set value, execute code B
So my goal is to execute code B, whenever any of these two conditions are false. I'm using OR (||) statement for that, but if length is higher, whole IF statement is still true because of number of tries is still higher than 0. I think AND(&&) is not a solution, because then it needs to be false both conditions, right?
if (currentDungeonLength <= dungeonLength || currentTries > 0)
{
//positive code A
}
else
{
//negative code B
}
Follow this Question
Related Questions
How to use IF in Unity for selection MyScript 1 Answer
Execution order of conditional operators in an if-statement 1 Answer
[GUI] Conditional Trigger for Button is flawed 0 Answers
Is There A Way To Make If Statement Condition Shorter 3 Answers
The If statement condition is false but the if statement stills executes 1 Answer