title: F# Array.FindIndex exception handling
body: <p>I have the following function that finds the Index in an Array</p>
  <pre><code>let numbers_array = [| &quot;1&quot;; &quot;2&quot;; &quot;3&quot;|]
  let findIndex arr elem = arr |&gt; Array.findIndex ((=) elem)
  
  let s = &quot;123&quot;
  findIndex numbers_array (string s.[0]))
  </code></pre>
  <p>However if i try to run</p>
  <p><code> findIndex numbers_array (string s.[10]))</code></p>
  <p>it is out of bounds and throws the following error</p>
  <p><em>System.Collections.Generic.KeyNotFoundException: An index satisfying the predicate was not found in the collection.</em></p>
  <p>How can i make my function so instead of throwing the exception it does something instead like a printf statement?</p>