When it is cold out, your ears get cold, so you put on a hat. soon, you put on the hat before going outside when you know it's cold out. this is an example of avoidance conditioning.
The term avoidance conditioning is used in psychology to denote a behavior pattern in which the subject learns behavior which will prevent the occurence of an aversive stimulus.