RosettaCodeData/Task/Stack/MATLAB/stack-1.m

14 lines
141 B
Mathematica
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
mystack = {};
% push
mystack{end+1} = x;
%pop
x = mystack{end}; mystack{end} = [];
%peek,top
x = mystack{end};
% empty
isempty(mystack)