From 8df0cc41c95e6c01d9c4c0fd1f57fbe96f40bbe7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 31 Dec 2024 15:57:13 -0500 Subject: Array:heap_pop() now returns an optional value --- docs/arrays.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/arrays.md b/docs/arrays.md index 3bb15bdf..7cae399a 100644 --- a/docs/arrays.md +++ b/docs/arrays.md @@ -456,12 +456,12 @@ func has(arr: [T] -> Bool) ### `heap_pop` **Description:** -Removes and returns the top element of a heap. By default, this is the -*minimum* value in the heap. +Removes and returns the top element of a heap or `none` if the array is empty. +By default, this is the *minimum* value in the heap. **Signature:** ```tomo -func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T) +func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T?) ``` **Parameters:** @@ -471,7 +471,7 @@ func heap_pop(arr: @[T], by: func(x,y:&T->Int32) = T.compare -> T) default comparison function for the item type will be used. **Returns:** -The removed top element of the heap. +The removed top element of the heap or `none` if the array is empty. **Example:** ```tomo -- cgit v1.2.3