I am getting to know SSIS, I apologize if the question is too simple.
I got a set of tasks inside a foreach-loop-container.
T
How about a simple solution instead of some of the more complex ones that have already been given. For the task you want to conditionally skip, add an expression to the disabled property. Any expression that produces a true or false result will work, so for the question example you could use:
ISNULL(@[User::MY_VAR]) || @[User::MY_VAR]==""
The only downside is that it may not as visible as some of the other solutions but it is far easier to implement.