Working with Templates#
<% and closing
<% let example = "Hi!"; print(example); %>
The use of the opening
I've made mistakes, Lord struck me down <%= "Caught in a landslide, lost underground" %> I hear them gates, swing open wide <%= "Come close to midnight, hell fade me down" %>
Underscore provides the function print() inside of any template code. This can be used to "print" values from inside an arbitrary code template block.
Running from the violence <% print("(Oh, oh. "); print("Oh, oh)"); %> Running from the violence
Note: Any variables created in a code block or in a
<script>element in Snowman are local to that scope. The only way to share values across passages is through global objects like s.
:: Untiled Passage <% s.example = "Hi!"; %> [[Another]] :: Another <%= s.example %>