Jump to content

Old lady swallowed a fly: Difference between revisions

m
→‎{{header|REXX}}: added/changed whitespace and comments, aligned some statements, changed some variable names.
m (→‎{{header|REXX}}: added/changed whitespace and comments, aligned some statements, changed some variable names.)
Line 1,316:
 
=={{header|REXX}}==
<lang rexx>/*REXX programpgm todisplays display thesong lyrics for the song: "I Know an Old Lady who Swallowed a Fly". */
@ sw=79 'fly spider bird cat dog goat cow horse' ; #=words(@) /*width of terminal screen, -1.*/
first I_know= "I know an old lady who swallowed a" ; sw=79
@ate = 'She swallowed the'; @2catch= "to catch the" ; @.=
@.1 = "I don't know why she swallowed a fly,"
@.2 = "That wriggled and jiggled and tickled inside her." ; @.2.0=1.
@.3 = "How absurd to swallow a bird!"
@.4 = "Imagine that, to swallow a cat!"
@.5 = "My, what a hog, to swallow a dog!"
@.6 = "Just opened her throat and swallowed a goat!"
@.7 = "I wonder how she swallowed a cow?!"
@.8 = "She's dead, of course!!"
$ = 'fly spider bird cat dog goat cow horse' ; #=words($)
 
do j=1 for #; animal=word(@,j); say /* [↓] display blank line*/
do j=1 for #; fauna=word($,j); say
say center(firstI_know animalfauna',', sw); if j\==1 then say center(@.j, sw)
if j==# then leave
if j==# then leave do k=j to 2 by -1; /*Last verse? We're km=k-1done.*/
saydo center(@ate word(@,k)=j to 2 by -1; @2catch word(@,km)',',sw)=k-1
say center(@ate word($,k) @2catch word($,km)',',sw)
if @.km.0\=='' then say center(@.km, sw)
end /*k*/ /* [↑] display the lyrics of the song.*/
say center(@.1, sw)
say center("I guess she'll die.", sw)
end /*j*/
/*stick a fork in it, we're all done. */</lang>
'''output''' &nbsp; (with the lyrics being centered):
<pre>
I know an old lady who swallowed a fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a spider,
That wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a bird,
How absurd to swallow a bird!
She swallowed the bird to catch the spider,
That wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a cat,
Imagine that, to swallow a cat!
She swallowed the cat to catch the bird,
She swallowed the bird to catch the spider,
That wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a dog,
My, 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,
That wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a goat,
Just opened her throat and swallowed a 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,
That wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a cow,
I wonder how she swallowed a 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,
That wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly,
I don't know why she swallowed a fly,
I guess she'll die.
 
I know an old lady who swallowed a horse,
She's dead, of course!!
</pre>
 
=={{header|Ruby}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.