Function Stack Class

Swap

Swap the two values on the top of a stack. Function returns True upon success and False upon failure.

Signature (Visual Basic / VBA)

Public Function Swap( _
    ) As Boolean

Code Example

    Assuming
       stkTemp.StringView() = "(Top) 4, 3, 2, 1 (Bottom)"
    for example
       stkTemp.Swap() = True
    leaves
       stkTemp.StringView() = "(Top) 3, 4, 2, 1 (Bottom)"

Return Value

Function returns True upon success. The function does nothing and returns False if there are fewer than two items on the stack.

Notes & Version History

Note Same as but faster than either RollDown (2) or RollUp (2)
v1.3 BugFix This Function has been fixed to support the Swapping of elements from Stacks containing Object and/or DataObject type Values.