xVar = (x > y) ? x: y;
And my question is just if you can use this to assign a variable to itself. For example, I have a war game where you send soldiers out to fight, and I need a statement that prevents more soldiers from dying than you sent out, so I want to use something like this.
soldiersDead = (soldiersDead >soldiersSent) ? soldiersSent: soldiersDead;
If there are more dead soldiers than you sent, then it is set to the amount of soldiers that you sent, otherwise it is set to the amount of soldiers that died.
My program has an error where all the swordsmen you send die no matter what, and I'm wondering if it has something to do with this statement.