Stack Operators

From WikiManual
Jump to: navigation, search

So question is what the hell is a stack in programming?

Well first we have to understand the concept of an array in programming. An array is a pretty much a list of numbers. For Darwinbots, the two `number` types we are referring are integers in the range of -32K to 32K and Boolean values. That's right, although a Boolean is technically not a number, a computer treats it as such.

So now a stack is actually a type of array. It designates an array that reads and writes using very specific rules. The rules are `last-in first-out`

What does last in mean?

Well imagine a list of numbers, obviously there will be a number at the top of this list and a number at the bottom. Last in means we always insert a number to the top of that list.

What does first out mean?

This means that the numbers are eliminated from the list starting from the top of the list.