Which line of code is better?

Which code of line is better, and why?
 
if ((i + 1) % 3 == 0)

or
 
if (i == 2 || i == 5)

Last edited on
The two are not equivalent, are they?

If i is guaranteed to be in [0,7], they are equivalent and
if (i == 2 || i == 5) is better (more readable, the intent is transparent).
Topic archived. No new replies allowed.