Content Freeze
As of July 25th, 2023, there is a content freeze on this page.
This API allows you to find an array element which is great than or equal to the argument you pass to it.
An optional resulting indicators object can specify if any elements in the flags array should be set. The resulting indicators object can have these properties:
- equal (Number) - identifies the flag number to set if an exact match is found
- high (Number) - identifies the flag number to set if the nearest higher entry is found
Parameters
- Search argument
- Array
- Start index (OR resulting indicators object)
- Resulting indicators object (optional)
Return Value
Returns 0 if no matching element is found; otherwise, the element index is returned.
Example
pjs.define("Word1", { type: 'char', length: 1 }); pjs.define("arr1", { type: 'char', length: 1, dim: 10, orderby: 'ASCEND' }); arr1[1] = 'A'; arr1[2] = 'B'; arr1[3] = 'C'; arr1[4] = 'C'; arr1[5] = 'E'; arr1[6] = 'E'; arr1[7] = 'F'; arr1[8] = 'G'; arr1[9] = 'G'; arr1[10] = 'H'; Word1 = 'D'; pjs.lookupGE(Word1, arr1, { high: 65, equal: 66 });
RPG Equivalent
%LOOKUPGE(), LOOKUP