Ruby 4.0 introduces Array#rfind, a new method that finds the last element matching a condition by iterating backwards. Unlike reverse.find or reverse_each.find, rfind doesn't create intermediate reversed arrays or enumerators, making it more memory-efficient for large arrays. The method is specific to Array rather than

2m read timeFrom andycroll.com
Post cover image
Table of contents
Instead of…Use…Why?Why not?Did you know?

Sort: