Applying Negative Switch Contexts
This page demonstrates Hashtag Negative Switch Contexts for conditionally printing a string based on the negativity of a value.
This is useful for applying CSS classes to numeric values.
The Hashtag Markup is shown below <# in bold #>.
Processing this Hashtag Markup:
<# set number to 7; #>
<# set negative to -7.2; #>
Note: Hashtag Markup Variable Tags are shown below <# in bold #>.
The values generated by processing them, and applying Negative Switch Contexts, is injected into the page after the ⇒ symbol.
<#[number as negativeswitch "Negative|Positive"]#> ⇒ Positive
<#[negative as negativeswitch "Negative|Positive"]#> ⇒ Negative