Thank you for taking the time to help me out. That's actually exactly what I had but wasn't sure if it would loop through replacing all elements with 0 and only return the last element.
no I'm making a black jack game so I need to be able to return the top card or first non zero element, then replace that top card with zero because it will no longer be in the deck.