Reputation: 3536
Is there a more succinct way of writing this?
articleCount += 1;
if (articleCount > 4)
{
// Reset counter to 1
articleCount = 1;
}
Upvotes: 0
Views: 111
Reputation: 22631
For those who like mathematical puzzles unreadable code, the following would work as well:
articleCount = (articleCount % 4) + 1;
Upvotes: 6