title: Break from while loop after 20 seconds
body: <p>How can I break from a while loop after 20 seconds have passed? I want to avoid the use of threads.</p>
  
  <pre><code>while (var) {
      // ...do something
  
      if (20secondsIsPassed) {
          break;
      }
  }
  </code></pre>