Cognitive flexibility is the ability and skill of being able to switch between thinking about two or more concepts at a time simultaneously and comparing their values. This type of flexibility is believed to a part of the executive function of the brain which is responsible for cognitive control. A simple example of this could be that while driving you have to consider the best route to your destination. In this you have to consider variables such as mileage, traffic density, time of day, etc. to determine the best solution.