From 9b66ec295ebf967000fb245024b9014bebf73f67 Mon Sep 17 00:00:00 2001 From: "George Njeri (Swagfin)" Date: Wed, 8 Oct 2025 01:16:40 +0300 Subject: [PATCH] chore: README Updates --- README.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 004c893..20318cb 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ I am Jane Doe! ```csharp Person person = new Person { - Name = "John Doe", MyCars = new List { new Car { Make = "BMW", Year = 2023 }, @@ -81,7 +80,6 @@ Person person = new Person }; string template = @" -{{ Name }}'s Cars {{ #foreach(MyCars) }} - {{ Year }} {{ Make }} {{ #endforeach }}"; @@ -93,13 +91,37 @@ Console.WriteLine(result); **Output:** ``` -John Doe's Cars - 2023 BMW - 2020 Rolls-Royce ``` --- -### Example 4: Number Formatting Support +### Example 4: Conditional Logic with `#if`, `#else`, and `#endif` + +```csharp +Person person = new Person +{ + Age = 40 +}; + +string template = @" +{{ #if(Age >= 18) }} + Adult +{{ #else }} + Minor +{{ #endif }}"; + +string result = person.Map(template); + +Console.WriteLine(result); +``` + +**Output:** +``` +Adult +``` +--- +### Example 5: Number Formatting Support ```csharp Car car = new Car