racket/collects/honu/examples/Stack-main.honu
2005-05-27 18:56:37 +00:00

26 lines
466 B
Plaintext

IStack main() {
IStack x = new CountedListStack : IStack();
IStack y = null;
x.push(new CharBox : Character(value = '5'));
x.push(new IntBox : Integer(value = 3));
y = x.copy();
while(!y.empty()) {
Any curr = y.pop();
if curr isa Character {
printLine("Got a character");
} else {
if curr isa Integer {
printLine("Got an integer");
} else {
printLine("Got something else");
};
};
};
x;
}