Below you will find pages that utilize the taxonomy term “imperative”
Posts
Declarative vs Imperative programming
Imperative programming focuses on ‘how’ and Declarative programming focuses on ‘what’.
Examples
C#
//Collection of integer objects List<int> collection = new List<int> { 1, 2, 3, 4, 5 }; //imperatively checking and creating a list of odd numbers List<int> results = new List<int>(); foreach(var num in collection) { if (num % 2 != 0) results.Add(num); } //doing the same 'declaratively' by using LINQ var results = collection.Where( num => num % 2 !
read more