Undestanding execution limit

Undestanding execution limit

Hi,
i'm trying to understand the execution limit on creator's function.
So, take a look to this screen:
This snippet work.
But if i add:
i reach execution limits.
Also if a wrote ONLY if (condition) {} this if gives to me an execution limit error.

But if i rewrite the logic like this:
works properly.
So... what? I don't understand the logic behind this error... How the last snippet can't reach execution limits and the first one, only for a simple "if" reach this error?
It's a bug or... ?

Salvatore