Skip to main content

Date_Range.find

findcondition start if_missing

Group: Selections

Documentation

Gets the first index when a condition is satisfied this range. If no index satisfies the predicate, returns if_missing.

Arguments

  • condition: A Filter_Condition or a predicate function to test each element.
  • start: The index to start searching from. If the index is negative, it is counted from the end of the range.
  • if_missing: Value returned if no element satisfies the predicate.

Examples

Get the first date in the range that is a Monday.

         (Date.new 2020 10 01).up_to (Date.new 2020 10 31) . find (d-> d.day_of_week == Day_Of_Week.Monday)