Jump to content

Old lady swallowed a fly: Difference between revisions

Add Cowgol
(Added 11l)
(Add Cowgol)
Line 953:
I know an old lady who swallowed a horse
She's dead, of course!</pre>
 
=={{header|Cowgol}}==
<lang cowgol>include "cowgol.coh";
 
var animals: [uint8][] := {
"fly", "spider", "bird", "cat", "dog", "goat", "cow", "horse"
};
 
var verses: [uint8][] := {
"I don't know why she swallowed that fly - Perhaps she'll die.\n",
"That wiggled and jiggled and tickled inside her!",
"How absurd, to swallow a bird",
"Imagine that! She swallowed a cat!",
"What a hog to swallow a dog",
"She just opened her throat and swallowed that goat",
"I don't know how she swallowed that cow",
"She's dead, of course."
};
 
var i: uint8 := 0;
while i < @sizeof animals loop
print("There was an old lady who swallowed a ");
print(animals[i]);
print(",\n");
print(verses[i]);
print_nl();
var j: uint8 := i;
while j > 0 and i < @sizeof animals-1 loop
print("She swallowed the ");
print(animals[j]);
print(" to catch the ");
print(animals[j-1]);
print(",\n");
if j <= 2 then
print(verses[j-1]);
print_nl();
end if;
j := j - 1;
end loop;
i := i + 1;
end loop;</lang>
 
=={{header|D}}==
2,114

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.