If you use Snowman with a lot of reusable code, or even if you build some kind of engine that runs a lot of code in every turn, there are two ways I can think of writing that reusable code.
<% somefunction() %>
b) You can put the code in its own passage, with
<% code %>, and invoke that passage whenever you need with
<% story.render("some passage") %>
<% %> template, so you need to expand the
s shorthand to the full
window.story.state. Which is uglier, but not a great difference.
EDIT: another obvious different if that using functions lets you use local variables, which makes it easier to name things without worrying.
(I also guess that, when the game is running, calling a function should be more efficient than the bunch of actions that render a passage. On the other hand, it’s hard to imagine a Twine game ever having performance problems!)
Any comments? Thanks!