Real-world behavior is typically more complicated than a one-to-one mapping between a stimulus and response; the same stimulus can lead to different behaviors depending on the situation, or the same behavior may be cued by different stimuli. In such cases, knowledge of the formal demands of the task at hand is required. We found that in monkeys trained to alternate between three tasks, the activity of many neurons in the prefrontal cortex was task dependent. This included changes in overall firing rate, in firing-rate profiles (shape of responses over time), and in stimulus and response selectivity. These findings support the hypothesis that a major prefrontal function is the acquisition and implementation of task context and the "rules" used to guide behavior.