Menu: Difference between revisions
Content added Content deleted
Simple9371 (talk | contribs) (→{{header|VBScript}}: corrected) |
Simple9371 (talk | contribs) (→{{header|VBScript}}: make prompt input instead of hard-coded...) |
||
Line 3,095: | Line 3,095: | ||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
<lang vb>'The Function |
<lang vb>'The Function |
||
Function Menu(ArrList) |
Function Menu(ArrList, Prompt) |
||
Select Case False 'Non-standard usage hahaha |
Select Case False 'Non-standard usage hahaha |
||
Case IsArray(ArrList) |
Case IsArray(ArrList) |
||
Line 3,109: | Line 3,109: | ||
WScript.StdOut.WriteLine((i + 1) & ". " & ArrList(i)) |
WScript.StdOut.WriteLine((i + 1) & ". " & ArrList(i)) |
||
Next |
Next |
||
WScript.StdOut.Write( |
WScript.StdOut.Write(Prompt) |
||
Choice = WScript.StdIn.ReadLine |
Choice = WScript.StdIn.ReadLine |
||
'Check if input is valid |
'Check if input is valid |
||
Line 3,128: | Line 3,128: | ||
'The Main Thing |
'The Main Thing |
||
Sample = Array("fee fie", "huff and puff", "mirror mirror", "tick tock") |
Sample = Array("fee fie", "huff and puff", "mirror mirror", "tick tock") |
||
InputText = "Which is from the three pigs: " |
|||
WScript.StdOut.WriteLine("Output: " & Menu(Sample))</lang> |
WScript.StdOut.WriteLine("Output: " & Menu(Sample, InputText))</lang> |
||
{{Out}} |
{{Out}} |
||
<pre>C:\>cscript /nologo menu.vbs |
<pre>C:\>cscript /nologo menu.vbs |