diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-31 15:57:13 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-31 15:57:13 -0500 |
| commit | 8df0cc41c95e6c01d9c4c0fd1f57fbe96f40bbe7 (patch) | |
| tree | b185443288bc600f04ba88c58d686b4b1e3fcea3 /docs | |
| parent | 156d54a73e005eecbb9a4284b74994313a34e4aa (diff) | |
Array:heap_pop() now returns an optional value
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/arrays.md | 8 |
1 files changed, 4 insertions, 4 deletions
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 |
