Swap
Swap
Stack | Position | Description |
---|---|---|
Stack(In) | Top | a |
Top 1 | b | |
Stack(Out) | Top | b |
Top 1 | a |
swaps the two values lying on Stack-Top and Stack-Top-1
Example:
// Put the object on the stack und duplicate it. The stack is now: object object
object Dup
// Copy the approved date of the stack top object and check if it is there. Leave result on stack
Copy(approved.date) if 1 else 0
// The stack is now: object 0
// Now bring the object on the stack top to check the next date:
Swap
// The stack is now: 0 object
// Check the released date and leave the result on stack again
Copy(released.date) if 1 else 0
// The stack is now: 0 0
// Compare with OR operand and show attention, if no date was found:
| ifnot { T("Objekt nicht freigegeben!", "Object not released yet!") Attention(AbortTXN) cancel
object Dup
// Copy the approved date of the stack top object and check if it is there. Leave result on stack
Copy(approved.date) if 1 else 0
// The stack is now: object 0
// Now bring the object on the stack top to check the next date:
Swap
// The stack is now: 0 object
// Check the released date and leave the result on stack again
Copy(released.date) if 1 else 0
// The stack is now: 0 0
// Compare with OR operand and show attention, if no date was found:
| ifnot { T("Objekt nicht freigegeben!", "Object not released yet!") Attention(AbortTXN) cancel