If else statement:- Genius student



  • This will execute at least one block, based on the condition.
  • If the condition is true, the if block execute otherwise the else block execute.
  • Syntax
    if (condition) {
        //block of code to be executed if the condition is true
    } else {
        //block of code to be executed if the condition is false
    }




    <!DOCTYPE html>
    <html>

    <head>
     <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>

    <body>

     <h1>if else</h1>

     <input type="button" onclick="chek();" value="check if else">
     <script>
      function chek()
      {
       if (30 > 40) //This condition is false so else is execute
       {
        alert("30 is big");
       }
       else
       {
        alert("40 is big");
       }

      }
     </script>

    </body>

    </html>
    If else statement:- Genius student If else statement:- Genius student Reviewed by Network security on October 14, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.