Yoda loved each and every Jedi he ever taught. Does that mean he contradicted his own teachings? No. because the code is trying to put forth the idea that emotion should not control a person's decision. To cast away all emotion is to become an uncaring apathetic shell. The Jedi just realize their emotions and feelings for what they are, but don't use them to fuel anger, revenge, aggression. It's impossible to completely disregard emotion.