updated main rpn loop to use for each syntax