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

11 lines
324 B
Forth

: madlibs
| story i word |
"" while(System.Console askln dup notEmpty) [ + ] drop ->story
while(story indexOf('<') dup ->i notNull) [
story extract(i, story indexOfFrom('>', i)) ->word
story replaceAll(word, "Word for" . word . System.Console askln) ->story
]
"Your story :" . story println ;