title: Google Apps Script - conditional user input - number prompt
body: <p>I need to get user input which should be a positive whole number (Integer). I figured out how to keep displaying prompt if the input is not a number, but I cant figure out how to write condition for number value. 
  Here is the code.</p>
  
  <pre><code>var ui = SpreadsheetApp.getUi(); // Same variations.
  
    do {
    var result = ui.prompt(
        'Please fill in',
        'Please enter number of people involved',
        ui.ButtonSet.OK_CANCEL);
    var text = parseInt(result.getResponseText());
    var button = result.getSelectedButton();
    }
    while (!(button == ui.Button.CANCEL) &amp;&amp; isNaN(parseInt(text)) &amp;&amp; !(button == ui.Button.CLOSE));
  
    var button = result.getSelectedButton();
    if (button == ui.Button.OK) {
      ui.alert('Number of people wanted: ' + text + '.');
    } else if (button == ui.Button.CANCEL) {
      ui.alert('Action cancelled.');
      return;
    } else if (button == ui.Button.CLOSE) {
      ui.alert('Action cancelled.');
      return;
    }
  </code></pre>
  
  <p>I tried, in my opinion, all the possible combinations of &lt;,>,!, &amp;&amp;, ||, but nothing worked..</p>