here is an interesting question:
if you were testing for 5 things to be true, would it be faster to test the first, then if it passes then next etc (if then else) of all at once (if & and)
e.g
or
-any ideas, insights....... (I think the latter, but....)
if you were testing for 5 things to be true, would it be faster to test the first, then if it passes then next etc (if then else) of all at once (if & and)
e.g
- Code:
bool click_area(int x1,int y1,int x2,int y2)
{
if ((clickxpos() > x1) && (clickxpos() < x2) &&
(clickypos() > y1) && (clickypos() < y2) && clicked())
{
return 1;
}
else return 0;
}
or
- Code:
bool click_area(int x1,int y1,int x2,int y2)
{
if (clickxpos() > x1)
if (clickxpos() < x2)
if (clickypos() > y1)
if (clickypos() < y2)
if clicked()
{
return 1;
}
else return 0;
}
-any ideas, insights....... (I think the latter, but....)