Mad Libs: Difference between revisions

Content added Content deleted
(→‎{{header|Perl}}: add Pascal)
Line 1,131:
Because a replacement text could in principle be lengthy (<name> = Monsieur Creosote, the well-known gourmand who ate three suckling pigs in one sitting and called for more) adjusting the stored strings is risky. Instead, the texts are written out piecemeal. There is no attempt to re-flow the resulting output into (say) neat 60-character lines.
 
A particular feature of Pascal strings is that text[i] gets the i'th character of a string variable ''text'' but copy(text,start,count) is needed for two or more characters. It is not clear whether in <code>if Target[it] = copy(bumf,mark,i - mark + 1) then ...</code> a temporary variable will be made to hold the result of the ''copy'' (as is implied by the name) or whether the comparison will be done "in place". Using <code>if Target[it] = hit then ...</code> ensures that one copy is made but loses the possibility that no copy would be made.
<lang Pascal>
Program Madlib; Uses DOS, crt; {See, for example, https://en.wikipedia.org/wiki/Mad_Libs}
Line 1,220:
END.
</lang>
 
=={{header|Perl}}==
Use the name of the file with a story as the parameter to the programme.