Cognitive flexibility is the mental ability to switch between thinking about two different concepts or to think about multiple concepts simultaneously, crucial for adapting to new and unexpected conditions. It is a core component of executive functions, enabling individuals to shift perspectives, strategies, or responses in the face of changing environments and demands.