please dont rip this site

Microsoft® JScript™
switch Statement
 Language Reference 
Version 3 

See Also

Enables the execution of one or more statements when a specified expression's value matches a label.
switch (expression) {
   case label :
   case label :
   default :

The switch statement syntax has these parts:

Part Description
expression The expression to be evaluated.
label An identifier to be matched against expression. If label === expression, execution starts with the statementlist immediately after the colon. and continues until it encounters either a break statement, which is optional, or the end of the switch statement. Without a break, execution will continue thru all following labels.
statementlist One or more statements to be executed.
Use the default clause to provide a statement to be executed if none of the label values matches expression. It can appear anywhere within the switch code block.

Zero or more label blocks may be specified. If no label matches the value of expression, and a default case is not supplied, no statements are executed.

Execution flows through a switch statement as follows:

  1. Evaluate expression and look at label in order until a match is found.
  2. If a label value equals expression, execute its accompanying statementlist.
    Continue execution until a break statement is encountered, or the switch statement ends. This means that multiple label blocks are executed if a break statement is not used.
  3. If no label equals expression, go to the default case. If there is no default case, go to last step.
  4. Continue execution at the statement following the end of the switch code block.

The following example tests an object for its type:

function MyObject() {
switch (object.constructor){
	case Date:
	 //code for a date
	case Number:
	 //code for a number
	case String:
	 //code for a string
	case MyObject:
	 //code for an "MyObject"
	 //code for "none of the above"

© 1997 by Microsoft Corporation. All rights reserved.


file: /Techref/inet/iis/jscript/htm/js766.htm, 4KB, , updated: 2018/6/7 17:55, local time: 2024/6/16 17:14,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> switch Statement</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!