Hello everyone, I have a pretty basic problem that I cannot seem to get my head around. I have a for loop that is incrementing, and within this for loop I want an if statement that will fire every 4 increments. How can I do this?
Thanks, Ryan
Hello everyone, I have a pretty basic problem that I cannot seem to get my head around. I have a for loop that is incrementing, and within this for loop I want an if statement that will fire every 4 increments. How can I do this?
Thanks, Ryan
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AlanRank #669 · 3.6K reputationPosted Sep 25, 2007, 2:35 PM EDT
Something like this:
for (int i = start; i <= finish; i++)
{
if (i > start && (i - start) % 4 == 0)
{
// do something
}
// other code
}
Ryan TurneyRank #7,345 · 243 reputationPosted Sep 26, 2007, 12:37 PM EDT