title: Find a matching or closest value in an array
body: <p>How can I search and find, for a given target value, the closest value in an array?</p>
  
  <p>Let's say I have this exemplary array:</p>
  
  <pre><code>array(0, 5, 10, 11, 12, 20)
  </code></pre>
  
  <p>For example, when I search with the target value 0, the function shall return 0; when I search with 3, it shall return 5; when I search with 14, it shall return 12.</p>