title: return with inner loop in a function which returns value
body: <p>I have a doubt as how return works in this case in C++. What happens to loops once condition matches and we need to return value.</p>
  
  <pre><code>some function(){
      for( )//outer loop with i and other values
      {
          for( )// inner loop with i and other values {
              some condition using if which on match return a value val (call it x here)
              return x;
          }
      }
      return -1
  }
  </code></pre>