Imperative

ImperativeDeclarative
You say how to get what you wantYou just say what you want
List<int> results = new List<int>();
foreach(var num in collection)
{
	if (num % 2 != 0)
	results.Add(num);
}

Here, we're saying:

  1. Create a result collection
  2. Step through each number in collection
  3. Check the number. If its odd, add it to the results

© 2025 All rights reservedBuilt with Flowershow Cloud

Built with LogoFlowershow Cloud