Writing with Ink – There Was an Old Lady

This Ink script challenge is children’s folksong with a cumulative structure:
There was an old lady who swallowed a fly

My solution after the jump.

Each verse gets longer by adding another phrase to the previous verse. I’ve made 2 separate functions to handle the repetitive bits. The verses progress with a Counter variable that adds one on each loop pass.

VAR Counter=0

-> looper

=== looper
~ Counter++
There was an old lady who swallowed a {CHASE(Counter)}
+ {Counter<=7} [next] -> looper
* -> DIE

=== function CHASE(x)
cow. {! I don't know how she swallowed a cow!|} {SWALLOW("cow")}
goat. {! She opened her throat and swallowed the goat!|} {SWALLOW("goat")}
dog. {! What a hog to swallow a dog!|} {SWALLOW("dog")}
cat. {! Imagine that! Swallowing a cat!|} {SWALLOW("cat")}
bird. {! How absurd to swallow a bird!|} {SWALLOW("bird")}
spider that wiggled and jiggled and tickled inside her. She swallowed the spider to chase the {CHASE(1)}
fly. I don't know why she swallowed a fly. Perhaps she'll die!

=== function SWALLOW(a)
She swallowed the {a} to chase the <>

=== DIE
<> horse. She died of course.
-> END

Each animal has a unique rhyming phrase. For the fly and the spider the rhyme play each cycle, but for the later animals the rhyme is only seen once. I’ve handled this with once-only cycling text:

{! How absurd to swallow a bird! | }

Remind me to revisit this example for 12 Days of Christmas.