Why `for/if` syntax is not allowed in loops

I think the main reason is that it introduces a parsing ambiguity that depends on whitespace. Your first example needs two end. Your second needs one.

The sum doesn’t have this ambiguity because generators to not use end.

You can achieve you intend with the somewhat horrific:

julia> for a in (a for a in 1:3 if isodd(a))
           @show a
       end
a = 1
a = 3
8 Likes