Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] select-case construct


  • From: javascript@xxxxxxxxxx (Muchacho, Laurent (TWIi London))
  • Subject: [Javascript] select-case construct
  • Date: Mon, 29 Oct 2001 20:09:39 -0000

Yes you can but in javascript it be called switch 

switch (i) {
   case "Oranges" : 
      document.write("Oranges are $0.59 a pound.<BR>"); 
      break; 
   case "Apples" : 
      document.write("Apples are $0.32 a pound.<BR>"); 
      break; 
   case "Bananas" : 
      document.write("Bananas are $0.48 a pound.<BR>"); 
      break; 
   case "Cherries" : 
      document.write("Cherries are $3.00 a pound.<BR>"); 
      break; 
   default : 
      document.write("Sorry, we are out of " + i + ".<BR>"); 
} 
document.write("Is there anything else you'd like?<BR>");

there is a link with a really good references
http://developer.netscape.com/docs/manuals/js/client/jsref/index.htm


Laurent

-----Original Message-----
From: Esther_Strom@xxxxxxxx [mailto:Esther_Strom@xxxxxxxx]
Sent: 29 October 2001 19:59
To: javascript@xxxxxxxxxx
Subject: [Javascript] select-case construct


I'm sure this has been mentioned before, but I can't find the message or an
example in any of my books. Can you use a select-case construct in
javascript?

Pseudocode example:

select case prodStatus

Case "New"
//do this

Case "In Progress"
//do this

Case else
//do this

End select

Thanks for any help available.

Esther

_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
http://www.LaTech.edu/mailman/listinfo/javascript