RosettaCodeData/Task/Stack/MiniScript/stack.mini

15 lines
408 B
Plaintext

// Note in Miniscript, a value of zero is false,
// and any other number is true.
// therefore the .len function works as the inverse of a .empty function
stack = [2, 4, 6]
stack.push 8
print "Stack is " + stack
print "Adding '9' to stack " + stack.push(9)
print "Top of stack is " + stack.pop
print "Stack is " + stack
if stack.len then
print "Stack is not empty"
else
print "Stack is empty"
end if