Function queue::top()

← Back to Class queue



Module adtClass queue → top()

Description

Retrieve but not remove the head of the Queue, or return nothing if the Queue is empty

queue::top()


Parameters

There are no parameters.


Return Value


Usage Example

import adt/queue
 
queue = queue()
 
queue.push(10)
queue.push(12)
queue.push(8)
 
writeln(queue.top())   ' Output: 10
writeln(queue.top())   ' Output: 10