spacer
Yehuda Shiran May 9, 2002
Defining the Enumeration's Discrete Values
Tips: May 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
Symbolic names you declare within the enum statement are numbered sequentially, starting at zero. In the following example:

  enum tvNetworkType {
    ABC,
    CBS,
    NBC,
    FOX
  }
the enumerated values are:

  ABC = 0;
  CBS = 1;
  NBC = 2;
  FOX = 3;
By default, the first member is initialized as zero. You can change it by setting its value explicitly. For example, you can decide that ABC should be equal to 1 instead of zero:

  enum tvNetworkType : byte {
    ABC = 1,
    CBS,
    NBC,
    FOX
  }
You can initialize any member of the enumerated type. By default, each member is one more than the previous member, if not explicitly initialized. In the above example, CBS is 2, NBC is 3, and FOX is 4. You can initialize all of them as follows:

  enum tvNetworkType : byte {
    ABC = 1,
    CBS = 2,
    NBC = 4,
    FOX = 8
  }
To learn more on JScript .NET, go to Column 108, JScript .NET, Part II: Major Features.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering MySQL Databases on the Web Using PHP · Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
So what is an Oracle Nested Table? · E-Discovery Architectures 101 · eBay Embraces Big Sellers, Cyber Monday Trends