# Can For loop be used with multiple conditions?

I am wondering if For could be used with multiple conditions (tests). For the simple example For[i = 0, i < 4; i > 0, i++, Print[i]] which prints 0, 1, 2, 3, is it possible to add another condition EvenQ[i] such that it only prints 0 and 2?

I tried For[i = 0, i < 4 && EvenQ[i], i++, Print[i]] which seems natural but does not work. Can anyone explain?

• Your test i<4 && EvenQ[i] is a stopping condition, so the For loop stops after $i=0$. – Carl Woll Jan 23 '18 at 18:38
• a;b always evaluates to b. Thus writing i < 4; i > 0 is the same as writing i > 0. Your first example doesn't really make sense. The second prints 0 because when i==1, EvenQ[i] evaluates to False, thus the loop stops. – Szabolcs Jan 23 '18 at 18:43
• why not use i += 2 for the increment? – george2079 Jan 23 '18 at 19:19
• @Szabolcs, thank you. Sorry in the first example I meant without ;i>0. But your pointing that out does answer another question of mine as if i < 4; i > 0 is actually two simultaneous conditions. I will take your comment as the answer. – nanjun Jan 23 '18 at 19:21