Old lady swallowed a fly: Difference between revisions

Add CLU
m (→‎{{header|Z80 Assembly}}: added comment lines to visually separate sections of the program)
(Add CLU)
Line 815:
There was an old lady who swallowed a horse
She's dead of course</pre>
 
=={{header|CLU}}==
<lang clu>old_lady = cluster is swallow
rep = null
own animals: array[string] := array[string]$[
"fly", "spider", "bird", "cat",
"dog", "goat", "cow", "horse"
]
own lines: array[string] := array[string]$[
"I don't know why she swallowed that fly.\nPerhaps 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."
]
verse = proc (s: stream, n: int)
stream$putl(s, "There was an old lady who swallowed a " || animals[n])
stream$putl(s, lines[n])
if n=8 then return end
for i: int in int$from_to_by(n, 2, -1) do
stream$putl(s, "She swallowed the " || animals[i]
|| " to catch the " || animals[i-1])
if i <= 3 then stream$putl(s, lines[i-1]) end
end
end verse
swallow = proc (s: stream)
for i: int in int$from_to(1, 8) do
verse(s, i)
end
end swallow
end old_lady
 
start_up = proc ()
old_lady$swallow(stream$primary_output())
end start_up</lang>
 
=={{header|COBOL}}==
Line 908 ⟶ 951:
</lang>
 
 
=={{header|Commodore BASIC}}==
2,115

edits