CHOICE BASED PROGRAMMING:-

 CHOICE BASED PROGRAMMING:-


1)in this concept user can create option based program.

2)choice based programming is used to switch case fundamental.


syntax:-


switch()

{

case 1: statement 

break;

case 2: statement

break;

case 3: statement

break;

default: statement (if choice can not match than returning default statement)

break;




<html>

<head>

<script language="JavaScript">


var ch;   

ch=parseInt(prompt("enter your choice"));

switch (ch)    

{

case 1: document.write("one");   

break;

 

case 2: document.write("two");

break;


case 3: document.write("three");

break;


case 4: documenr.write("four");

break;


default: document.write("invalid choice");   

break;


}


</script>

</head>

</html>


Comments

Popular posts from this blog

HTML FORMS

condition management IF, ELSE, ELSEIF

HTML NOTES