Old lady swallowed a fly: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: syntax coloured) |
No edit summary |
||
Line 3,725: | Line 3,725: | ||
end for |
end for |
||
in string console</lang> |
in string console</lang> |
||
=={{header|Vlang}}== |
|||
<lang vlang>const ( |
|||
name = 0 |
|||
lyric = 1 |
|||
animals = [ |
|||
["fly", "I don't know why she swallowed a fly. Perhaps she'll die."], |
|||
["spider", "That wiggled and jiggled and tickled inside her."], |
|||
["bird", "How absurd, to swallow a bird."], |
|||
["cat", "Imagine that, she swallowed a cat."], |
|||
["dog", "What a hog, to swallow a dog."], |
|||
["goat", "She just opened her throat and swallowed that goat."], |
|||
["cow", "I don't know how she swallowed that cow."], |
|||
["horse", "She's dead, of course."], |
|||
] |
|||
) |
|||
fn main() { |
|||
for i, animal in animals { |
|||
println("There was an old lady who swallowed a ${animal[name]},") |
|||
if i > 0 { |
|||
println(animal[lyric]) |
|||
} |
|||
// Swallowing the last animal signals her death, cutting the |
|||
// lyrics short. |
|||
if i+1 == animals.len { |
|||
break |
|||
} |
|||
for j := i; j > 0; j-- { |
|||
println("She swallowed the ${animals[j][name]} to catch the ${animals[j-1][name]},") |
|||
} |
|||
println("${animals[0][lyric]}\n") |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
<pre> |
|||
There was an old lady who swallowed a fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a spider, |
|||
That wiggled and jiggled and tickled inside her. |
|||
She swallowed the spider to catch the fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a bird, |
|||
How absurd, to swallow a bird. |
|||
She swallowed the bird to catch the spider, |
|||
She swallowed the spider to catch the fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a cat, |
|||
Imagine that, she swallowed a cat. |
|||
She swallowed the cat to catch the bird, |
|||
She swallowed the bird to catch the spider, |
|||
She swallowed the spider to catch the fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a dog, |
|||
What a hog, to swallow a dog. |
|||
She swallowed the dog to catch the cat, |
|||
She swallowed the cat to catch the bird, |
|||
She swallowed the bird to catch the spider, |
|||
She swallowed the spider to catch the fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a goat, |
|||
She just opened her throat and swallowed that goat. |
|||
She swallowed the goat to catch the dog, |
|||
She swallowed the dog to catch the cat, |
|||
She swallowed the cat to catch the bird, |
|||
She swallowed the bird to catch the spider, |
|||
She swallowed the spider to catch the fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a cow, |
|||
I don't know how she swallowed that cow. |
|||
She swallowed the cow to catch the goat, |
|||
She swallowed the goat to catch the dog, |
|||
She swallowed the dog to catch the cat, |
|||
She swallowed the cat to catch the bird, |
|||
She swallowed the bird to catch the spider, |
|||
She swallowed the spider to catch the fly, |
|||
I don't know why she swallowed a fly. Perhaps she'll die. |
|||
There was an old lady who swallowed a horse, |
|||
She's dead, of course. |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |