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)
{x==7:
cow. {! I don't know how she swallowed a cow!|} {SWALLOW("cow")}
{CHASE(6)}
}{x==6:
goat. {! She opened her throat and swallowed the goat!|} {SWALLOW("goat")}
{CHASE(5)}
}
{x==5:
dog. {! What a hog to swallow a dog!|} {SWALLOW("dog")}
{CHASE(4)}
}
{x==4:
cat. {! Imagine that! Swallowing a cat!|} {SWALLOW("cat")}
{CHASE(3)}
}
{x==3:
bird. {! How absurd to swallow a bird!|} {SWALLOW("bird")}
{CHASE(2)}
}
{x==2:
spider that wiggled and jiggled and tickled inside her. She swallowed the spider to chase the {CHASE(1)}
}
{x==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.