If You Detect None
# without the fallback behavior
> [2,4,6,8].detect { |x| x.odd? }
=> nil
# with a proc as an argument
> [2,4,6,8].detect(->{0}) { |x| x.odd? }
=> 0> [2,4,6,8].detect(->{0}, &:odd?)
=> 0> [2,4,6,8].detect(ifnone=->{0}, &:odd?)
=> 0Last updated