Determine whether an number is one greater or one less than another in a circular set
<p>I am kicking myself for having to ask this ...I can solve this with a couple of simple 'if' statements, but I am sure there is a simpler way!</p>

<p>I have a paging control which allows the user to move one page left or one page right. Each page has an index. The pages cycle, therefore if you have three pages and you keep moving right the user sees:</p>

<pre><code>0 =&gt; 1 =&gt; 2 =&gt; 0 =&gt; 1 ...
</code></pre>

<p>I have the current page index and the previous page index. How can I determine if the user has paged right or left?</p>

<p>Thanks!</p>
