How to Run Interval Comparison in Shortcuts
Let’s assume you have a number M. You want to compare it to the array of the numbers (e.g. n1, n2, n3 …) to see if it’s within certain range. This custom shortcut returns just that; where the number M would be in, if it were to be inserted into the array.
- Download the shortcut from this link.
- In order to use the shortcut, a dictionary must be passed in text format:
{"input": M, "array": [n1, n2, n3, ...]}
For example, this would return 2
as the result:
{"input": 10, "array": [5, 15, 25]}
Please be mindful that the array must be ordered. To properly use the shortcut, it’s best to run it from another shortcut and process the result as needed.
As always, you can create your own version of the shortcut. It’s simply repeating through each item in the array until the input M is less than or equal to the repeated item’s index number. Shortcuts app will ask if you do wish to let a shortcut run another shortcut when run for the first time.