VBScript to perform Stack operations
kw.vbs
Set Stack = CreateObject("System.Collections.Stack") Stack.Push "Apple" Stack.Push "Banana" Stack.Push "Cherry" Stack.Push "Durian" For Each item In Stack s = s & item & " " Next print s print Stack.Contains("Apple") & vbCrLf print "Count " & Stack.Count print "Pop " & Stack.Pop & vbCrLf print "Peek " & Stack.Peek & vbCrLf print Join(Stack.ToArray, ", ") & vbCrLf
Output
Durian Cherry Banana Apple True Count 4 Pop Durian Peek Cherry Cherry, Banana, Apple
Comments and Reactions
What Next?
VBScript to perform Queue operations
VBScript to create an empty folder
VBScript to create an empty text file
Advertisement