Supporting both paradigms#
You can actually use Python in both declarative and imperative programming. Over the years, some other imperative languages have also received updates allowing them to support declarative-style programming. These include JavaScript, C++, and C#.
C++ in particular has seen several improvements in recent years, many of which make C++ more declarative. For example, newer versions of C++ have the Standard Template Library (STL), which provides four components: algorithms, containers, functions, and iterators.
Among these components are several built-in functions or operations that were previously performed manually, such as std::sort and std::list. Now you can easily use std::sort and continue coding without having to develop an imperative sorting algorithm.
The following code example demonstrates this feature at work: