Skip to content

Commit 734f454

Browse files
authored
Merge pull request #19 from swagfin/optimized-engine
chore: README Updates
2 parents 491cf96 + 9b66ec2 commit 734f454

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ I am Jane Doe!
7272
```csharp
7373
Person person = new Person
7474
{
75-
Name = "John Doe",
7675
MyCars = new List<Car>
7776
{
7877
new Car { Make = "BMW", Year = 2023 },
@@ -81,7 +80,6 @@ Person person = new Person
8180
};
8281

8382
string template = @"
84-
{{ Name }}'s Cars
8583
{{ #foreach(MyCars) }}
8684
- {{ Year }} {{ Make }}
8785
{{ #endforeach }}";
@@ -93,13 +91,37 @@ Console.WriteLine(result);
9391

9492
**Output:**
9593
```
96-
John Doe's Cars
9794
- 2023 BMW
9895
- 2020 Rolls-Royce
9996
```
10097
---
10198

102-
### Example 4: Number Formatting Support
99+
### Example 4: Conditional Logic with `#if`, `#else`, and `#endif`
100+
101+
```csharp
102+
Person person = new Person
103+
{
104+
Age = 40
105+
};
106+
107+
string template = @"
108+
{{ #if(Age >= 18) }}
109+
Adult
110+
{{ #else }}
111+
Minor
112+
{{ #endif }}";
113+
114+
string result = person.Map(template);
115+
116+
Console.WriteLine(result);
117+
```
118+
119+
**Output:**
120+
```
121+
Adult
122+
```
123+
---
124+
### Example 5: Number Formatting Support
103125

104126
```csharp
105127
Car car = new Car

0 commit comments

Comments
 (0)