advice concerning statements inside if

My question is not about a bug, but for some advice.

before i move a square i check to see if it will out of bounds, if so then it moves on and so on

the statements if( ! something ) as below could be written for eg:

if((pozX+moveSizeX)<(sizeX-100))

which would be better? the version above or version below?
what would be the recommended use of if (if there is any)

my googling came out with mixed results
i never gave it much thought till now.

1
2
3
4
5
6
7
8
9
10
11
12
  switch (evt.key.code) {
             case sf::Keyboard::Right :
                 if(!((pozX+moveSizeX)>(sizeX-100))){
                     highlightBox.move(moveSizeX, 0);
                 }
                 break;
             case sf::Keyboard::Down :
                 if(!((pozY+moveSizeY)>(sizeY-100))){
                     highlightBox.move(0, moveSizeY);
                 }
                 break;
// etc 

I find if((pozX+moveSizeX)<(sizeX-100))more readable.
Topic archived. No new replies allowed.