{{expression}}
{{expression ` format}}
format
is a .NET format string.
Data:
context = new FlexContext(new {product="iPhone X", price=999});
Template:
The price of {{product}} is {{price ` $0.00}}
Result:
The price of iPhone X is $999.00
{{foreach varName in collection}}
{{end}}
(ends the loop block)
{{foreach product in products}}
- Product {{product.name}} costs {{product.price ` $0.00}}
{{end}}
To use a for-loop with a counter, foreach
can be used with the range operator:
{{foreach i in 1...10}}#{{i}} {{end}}
Output:
#1 #2 #3 #4 #5 #6 #7 #8 #9 #10
{{if condition}}
{{elseif}}
{{else}}
{{end}}