Associative learning enables animals to anticipate the occurrence of important outcomes. Learning occurs when the actual outcome differs from the predicted outcome, resulting in a prediction error. Neurons in several brain structures appear to code prediction errors in relation to rewards, punishments, external stimuli, and behavioral reactions. In one form, dopamine neurons, norepinephrine neurons, and nucleus basalis neurons broadcast prediction errors as global reinforcement or teaching signals to large postsynaptic structures. In other cases, error signals are coded by selected neurons in the cerebellum, superior colliculus, frontal eye fields, parietal cortex, striatum, and visual system, where they influence specific subgroups of neurons. Prediction errors can be used in postsynaptic structures for the immediate selection of behavior or for synaptic changes underlying behavioral learning. The coding of prediction errors may represent a basic mode of brain function that may also contribute to the processing of sensory information and the short-term control of behavior.