RosettaCodeData/Task/Mad-Libs/Icon/mad-libs.icon
2023-07-01 13:44:08 -04:00

16 lines
513 B
Text

procedure main()
ml := "<name> went for a walk in the park. There <he or she> _
found a <noun>. <name> decided to take it home." # sample
MadLib(ml) # run it
end
link strings
procedure MadLib(story)
write("Please provide words for the following:")
V := []
story ? while ( tab(upto('<')), put(V,tab(upto('>')+1)) )
every writes(v := !set(V)," : ") do
story := replace(story,v,read())
write("\nYour MadLib follows:\n",story)
end