learn dynamic variable with condition