Determining the Number of Elements on the Stack

The QUEUED built-in function returns the total number of elements on a data stack. For example, to find out how many elements are on the data stack, you can use the QUEUED function with no arguments.
SAY QUEUED()         /* displays a decimal number */
To remove all elements from a data stack and display them, you can use the QUEUED function as follows:
number = QUEUED()
DO number
  PULL element
  SAY element
END