Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Do, While or For Loops in Twine

Hi, people

I would like to suggest a Twine macro that simulates for, while or do in the programmation. Look this link:

It's great. It's very practical but a macro would be easier.

Macro Names: <<while >> <<for>> <<do>> ...



  • Each story format defines it's own macro list and depending on the story format you are using, you may find that some of these macro/features already exist.

    The SugarCube story format has a <<for>> macro. (v1 docs & v2 docs)

    The Snowman story format supports the usage of the Javascript for statement in your passages.

    The Harlowe story format includes the (live:) macro which can be used to emulate those three macros.
  • A simple, basic guide I wrote in Febuary, 2014: How to Create Loops in Twine
  • One limitation with that method is it only works if you need up to 25 iterations. If you try to loop more than 25 times it assumes the story has gone into an infinite loop and errors out.
Sign In or Register to comment.