Contents

Conditions Loop

Script Switch

A switch is used to test a number of different conditions. If no conditions are met then the default condition is used.


switch(Value){
case 1:
break;
case 2:
break;
default:
break;
}

Example:


var Name="Anne",Match="?";
switch(Name){
case "Sarah":
Match
="Sarah is my friend.";
break;
case "Wendy":
Match
="I don't like wendy.";
break;
case "Anne":
Match
="I love Anne.";
break;
default:
Match
="I don't know this name.";
break;
}

Conditions Loop