lundi 26 juin 2017

How to compare an integer to see if it's equal to a certain number, plus or minus 2

I would like to be able to create an if statement that checks to see if GlobalVars is equal to 92 plus or minus 2.

I was just hoping there was a way I could do it without stating the range 90-94.. ie a 92 -/+ 2 equivalent.

I have the below code so far:

if (GlobalVars.myIP3 == 92 || GlobalVars.myIP3 == 93)
{ 
}

Aucun commentaire:

Enregistrer un commentaire