Old lady swallowed a fly: Difference between revisions

Add BCPL
(Add PL/M)
(Add BCPL)
Line 600:
ENDCASE
ENDPROC</lang>
 
=={{header|BCPL}}==
<lang bcpl>get "libhdr"
 
let animal(n) =
n=0 -> "fly", n=1 -> "spider", n=2 -> "bird",
n=3 -> "cat", n=4 -> "dog", n=5 -> "goat",
n=6 -> "cow", n=7 -> "horse", valof finish
let line(n) =
n=0 -> "I don't know why she swallowed that fly,*NPerhaps she'll die.*N",
n=1 -> "That wiggled and jiggled and tickled inside her",
n=2 -> "How absurd to swallow a bird",
n=3 -> "Imagine that, she swallowed a cat!",
n=4 -> "What a hog to swallow a dog",
n=5 -> "She just opened her throat and swallowed that goat",
n=6 -> "I don't know how she swallowed that cow",
n=7 -> "She's dead, of course.",
valof finish
 
let verse(n) be
$( writef("There was an old lady who swallowed a %S,*N", animal(n))
writef("%S*N", line(n))
unless n=7 for i=n to 1 by -1
$( writef("She swallowed the %S to catch the %S,*N",
animal(i), animal(i-1))
if i <= 2 do writef("%S*N", line(i-1))
$)
$)
 
let start() be for n=0 to 7 do verse(n)</lang>
 
=={{header|Befunge}}==
2,093

edits