Code Blocks

Code blocks are used to define inline code or inline expressions that execute when the template is processed. Use inline code to define code blocks or control flow blocks. Use inline expressions as a shortcut for calling the Writer.Write method.

Script Block Description
<# code #> Defines one or more lines of code that executes when the template is processed.
<# code ##>

Defines one or more lines of code that executes when the template is processed. Ignores all white space characters (including the EndOfLine symbol) starting from the ending tag ##> till either the end of line or any non-white space symbol.

<#= expression #> Shortcut for <# Writer.Write(expression); #>
<#= expression ##> Shortcut for <# Writer.Write(expression); ##>

Examples

Code Output
<#
for(int i = 0; i < 5; i++)
{
    Writer.Write(i);
}
#>
01234

<#= "Hello " #>
<#= "World" #>

Hello
World

<#= "Hello " ##>
<#= "World" #>

Hello World