An if-statement performance question

Hello all,

Let's say I've got the following statement:

1
2
3

if (number > 10.0 && number < 5.0) do_something();


Then would I lose or gain performance by doing this:

1
2
3
4
5
6
7

if (number > 10.0) {
   
   if (number < 5.0) do_something();

}


?

Last edited on
Performance is the same.
most compilers optimize it anyways so the main objective for you as a programmer should be to make the code readable by other people

also what's up with checking if value is larger than 10 AND smaller than 5? :)
Topic archived. No new replies allowed.