Mad Libs: Difference between revisions
Content added Content deleted
No edit summary |
Simple9371 (talk | contribs) m (→{{header|VBScript}}: improved formatting) |
||
Line 2,933: | Line 2,933: | ||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
<lang vb> |
<lang vb>Function mad_libs(s) |
||
Do |
|||
⚫ | |||
If InStr(1,s,"<") <> 0 Then |
|||
Do |
|||
start_position = InStr(1,s,"<") + 1 |
|||
end_position = InStr(1,s,">") |
|||
⚫ | |||
end_position = InStr(1,s,">") |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Else |
|||
⚫ | |||
Exit Do |
|||
Else |
|||
⚫ | |||
Exit Do |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
mad_libs = s |
|||
End Function |
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.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 |
WScript.StdOut.WriteLine</lang> |
||
</lang> |
|||
{{Out}} |
{{Out}} |
||
⚫ | |||
<pre> |
|||
⚫ | |||
name? babe |
name? babe |
||
he or she? she |
he or she? she |
||
noun? cat |
noun? cat |
||
babe went for a walk in the park. she found a cat. babe decided to take it home. |
babe went for a walk in the park. she found a cat. babe decided to take it home.</pre> |
||
</pre> |
|||
=={{header|Visual Basic .NET}}== |
=={{header|Visual Basic .NET}}== |