title: How can I compare a nil wth an integer?
body: <p>With Ruby 2.4, I have this in part of my "if" statement</p>
  
  <pre><code>row_data.index{|x| DataHelper.my_function(x) } &gt; num_var
  </code></pre>
  
  <p>Unfortunately, the above statement dies with an error if "row_data.index{|x| DataHelper.my_function(x) }" evaluates to nil.  Is there any way to rewrite the above so that it would return "false" if "row_data.index{|x| DataHelper.my_function(x) }" evaluated to nil?  I don't want to store the expression in a variable prior to my "if" statement because I might not need to even execute that statement if execution doesn't reach there.  I feel like there's a one-liner but I don't know what it is.</p>