Nested Conditional with Compound Statements

Same as if5, but slightly different style.

If the number is 9
    say it is 9
    say fun
otherwise if the number is 0
    say it is 0
otherwise
    say it is neither
    say boring

Enter a number, script checks for 9

Compare to switch1



  <script>
    function checkValue(){
      var val = document.getElementById("num").value;
      if (val == 9) {
        alert("the number entered is 9");
        alert("this is fun");
        }
      else if (val == 0)
          alert("Hey, that's a 0");
      else {
          alert("the number entered is not 9 or 0");
          alert("this is kinda boring");
          }
    }
  </script>