A task was designed to teach individual flies to avoid a lighted area after they had displayed an initial preference for it. The flies walked in a T-maze and chose between a lighted and a darkened alley leading, respectively, to a lighted and a darkened vial. Flies that were photopositive on a first trial were subjected to an aversive stimulus (a filter paper inserted into the lighted vial and wetted with a quinine solution), and they performed 16 training trials; they learned to avoid the lighted vial. The flies trained with water instead of quinine in the lighted vial still display avoidance of the lighted vial, but to a lesser extent. The flies trained with a dry filter paper in the lighted vial did not show any increase in avoidance during training. Like the flies trained with no quinine at all, those trained to avoid the lighted vial under a partial reinforcement condition (one half of the trials with quinine, the other half with a dry vial) did not master the task. Finally, removal of the quinine after an avoidance acquisition criterion was reached resulted in an extinction process.