Mad Libs: Difference between revisions

Content deleted Content added
Simple9371 (talk | contribs)
m →‎{{header|VBScript}}: improved formatting
Jjuanhdez (talk | contribs)
Mad Libs en PureBasic
Line 2,444: Line 2,444:


Foo went for a walk in the park. He found a bar. Foo decided to take it home.
Foo went for a walk in the park. He found a bar. Foo decided to take it home.
</pre>


=={{header|PureBasic}}==
{{trans|FreeBASIC}}
<lang PureBasic>
If OpenConsole()
cadena$ = "<name> went for a walk in the park. <he or she> found a <noun>. <name> decided to take it home."
k = FindString(cadena$, "<")
PrintN("La historia: ")
Print(cadena$ + Chr(10))
While k
reemplaza$ = Mid(cadena$, k, FindString(cadena$, ">") - k + 1)
Print(Chr(10) + "What should replace " + reemplaza$ + " ")
con$ = Input ()
While k
cadena$ = Left(cadena$, k-1) + con$ + Mid(cadena$, k + Len(reemplaza$))
k = FindString(cadena$, reemplaza$, k)
Wend
k = FindString(cadena$, "<")
Wend
PrintN(Chr(10) + "La historia final: ")
PrintN(cadena$)
Input()
CloseConsole()
EndIf
End
</lang>
{{out}}
<pre>
Igual que la entrada de FreeBASIC.
</pre>
</pre>