Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

find_key

container.sorted_array.find_key

find index of given key using binary search

The guaranteed performance is in O(log n) comparisons.

result is the index where key was found or nil if key is not
in this array. In case several instance equal to key are in
this sorted_array, the index of one of the matching keys will be
returned, but is not specified which one.
Postcondition
post
  match result
    i i32 => # sorted_array.this[i] = key, but we do not have 'infix =' available, so
             # use less_than_or_equal instead:
             #
             less_than_or_equal sorted_array.this[i] key && less_than_or_equal key sorted_array.this[i]
    nil   => true
0.095dev (GIT hash 5f19dac1008648f355e38b291a14980aecf8af80)
last changed: 2026-05-19