Operant conditioning is a type of learning that includes rewards and punishments. The goal of operant conditioning is to create an association between a behavior and a consequence whether is it negative or positive. A common example of operant conditioning is when a lab rats press a lever when a green light is on and the rat receives a piece of food. Or the rat presses a lever when there is a red light on and they receive a shock. The lab rats learn to only press the lever when the light is green.
There are many components to operant conditioning; positive reinforcers, negative reinforcers, positive punishment, and negative punishment. Positive reinforcers are favorable events that are presented after the behavior. For example, a student gets an "A" on a test and the teacher gives them a gold star. The gold star is the positive reinforcement. Negative reinforcement is the removal of an unfavorable event after the behavior. For example, you put on sunscreen before going outside to avoid getting sunburned. The sunscreen is the behavior and avoiding the sunburn is the removal of an unfavorable event. Positive punishment goal is to decrease an unfavorable behavior by introducing an unfavorable outcome. For example, driving over the speed limit and getting pulled over, and receiving a ticket. You are now less likely to drive over the speed limit. Negative punishment is taking something desirable away to reduce the behavior. For example, a kid stays out past curfew so the parents take the child's phone for a week. Here is a diagram to help better understand the differences and goals.
Powell R. A., Honey P. L., & Symbaluk D. G. (2016). Introduction to Learning and Behavior. [VitalSource Bookshelf]. Retrieved from https://bookshelf.vitalsource.com/#/books/9781305887480/