Old lady swallowed a fly: Difference between revisions
Content deleted Content added
m added whitespace before the TOC (table of contents), added a ;Task: and ;Related task: (bold) headers. |
Added BBC BASIC |
||
Line 321: | Line 321: | ||
her throat$Cow3.|I don't know how'Donkey6.|It was rather wonky&Horse:.|She's d |
her throat$Cow3.|I don't know how'Donkey6.|It was rather wonky&Horse:.|She's d |
||
ead, of course!|</lang> |
ead, of course!|</lang> |
||
=={{header|BBC BASIC}}== |
|||
This prints the lyrics from the Wikipedia page, more or less. I don't know anything about goats and donkeys and the like. |
|||
<lang bbcbasic>REM >oldlady |
|||
DIM swallowings$(6, 1) |
|||
swallowings$() = "fly", "+why", "spider", "That wriggled and wiggled and tickled inside her", "bird", ":How absurd", "cat", ":Fancy that", "dog", ":What a hog", "cow", "+how", "horse", "She's dead, of course" |
|||
FOR i% = 0 TO 6 |
|||
PRINT "There was an old lady who swallowed a "; swallowings$(i%, 0); "..." |
|||
PROC_comment_on_swallowing(swallowings$(i%, 0), swallowings$(i%, 1)) |
|||
IF i% > 0 AND i% < 6 THEN |
|||
FOR j% = i% TO 1 STEP -1 |
|||
PRINT "She swallowed the "; swallowings$(j%, 0); " to catch the "; swallowings$(j% - 1, 0); "," |
|||
NEXT |
|||
PROC_comment_on_swallowing(swallowings$(0, 0), swallowings$(0, 1)) |
|||
ENDIF |
|||
PRINT |
|||
NEXT |
|||
END |
|||
: |
|||
DEF PROC_comment_on_swallowing(animal$, observation$) |
|||
CASE LEFT$(observation$, 1) OF |
|||
WHEN "+": |
|||
PRINT "I don't know "; MID$(observation$, 2); " she swallowed a "; animal$; |
|||
IF animal$ = "fly" THEN PRINT " -- perhaps she'll die"; |
|||
PRINT "!" |
|||
WHEN ":" |
|||
PRINT MID$(observation$, 2); ", to swallow a "; animal$; "!" |
|||
OTHERWISE |
|||
PRINT observation$; "!" |
|||
ENDCASE |
|||
ENDPROC</lang> |
|||
=={{header|C}}== |
=={{header|C}}== |