Mad Libs: Difference between revisions
Content deleted Content added
No edit summary |
Simple9371 (talk | contribs) m →{{header|VBScript}}: improved formatting |
||
Line 2,933:
=={{header|VBScript}}==
<lang vb>Function mad_libs(s)
Do
Function mad_libs(s)▼
If InStr(1,s,"<") <> 0 Then
▲ parse_string = Mid(s,start_position,end_position-start_position)
▲ WScript.StdOut.Write parse_string & "? "
▲ input_string = WScript.StdIn.ReadLine
Else
▲ s = Replace(s,"<" & parse_string & ">",input_string)
Exit Do
▲ End If
▲ Loop
End Function
WScript.StdOut.Write mad_libs("<name> went for a walk in the park. <he or she> found a <noun>. <name> decided to take it home.")
WScript.StdOut.WriteLine</lang>
{{Out}}
<pre>F:\>cscript /nologo mad_libs.vbs▼
▲F:\>cscript /nologo mad_libs.vbs
name? babe
he or she? she
noun? cat
babe went for a walk in the park. she found a cat. babe decided to take it home.</pre>
=={{header|Visual Basic .NET}}==
|