Old lady swallowed a fly: Difference between revisions
Content added Content deleted
(Applesoft BASIC) |
No edit summary |
||
Line 1,801: | Line 1,801: | ||
main = putStr $ unlines song</syntaxhighlight> |
main = putStr $ unlines song</syntaxhighlight> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
include "NSLog.incl" |
|||
void local fn OldLadySwallowedAFly |
|||
NSUInteger i, j, count |
|||
CFArrayRef animals = @[@"fly", @"spider", @"bird", @"cat", @"dog", @"goat", @"cow", @"horse"] |
|||
CFArrayRef verses = @[@"",¬ |
|||
@"I don't know why she swallowed the fly.\nPerhaps she'll die!\n",¬ |
|||
@"That wriggled 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 wonder how she swallowed a cow?",¬ |
|||
@"She's dead of course!"] |
|||
count = fn ArrayCount( animals ) |
|||
for i = 0 to count - 1 |
|||
NSLog( @"There was an old lady who swallowed a %@.", animals[i] ) |
|||
if i == 0 then NSLog( @"%@", verses[1] ) : continue |
|||
if i > 0 then NSLog( @"%@", verses[i+1] ) |
|||
if i == 7 then exit fn |
|||
if ( i > 0 ) |
|||
for j = i to 1 step -1 |
|||
NSLog( @"\tShe swallowed the %@ to catch the %@.", animals[j], animals[j-1] ) |
|||
if ( j == 1 ) then NSLog( @"%@", verses[1] ) : exit for |
|||
next |
|||
end if |
|||
next |
|||
end fn |
|||
fn OldLadySwallowedAFly |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
There was an old lady who swallowed a fly. |
|||
I don't know why she swallowed the fly. |
|||
Perhaps she'll die! |
|||
There was 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 the 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 the 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 the 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 the 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 the fly. |
|||
Perhaps she'll die! |
|||
There was 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. |
|||
She swallowed the spider to catch the fly. |
|||
I don't know why she swallowed the fly. |
|||
Perhaps she'll die! |
|||
There was an old lady who swallowed a horse. |
|||
She's dead of course! |
|||
</pre> |
|||
=={{header|Go}}== |
=={{header|Go}}== |