Section 9.2

Topics: Language Specification
Sep 20, 2013 at 4:03 PM
Page 95 has the following code and text.

enum Test {
C = 10,
E = Math.floor(Math.random() * 1000)
‘A’, ‘B’, ‘C’, and ‘D’ are constant members with values 0, 1, 10, and 11 respectively, and ‘E’ is a computed

How is 'A', 'B', 'C', 'D constant members with values of 0, 1, 10, and 11?? I see how C=10, but that's it.
Sep 20, 2013 at 6:24 PM
This part of 9.2 describes the initialization values:

A constant member declared with an integer literal value is assigned that value. A constant member declared without an integer literal value is assigned the value of the preceding constant member plus one, or the value zero if it is the first member in the enum body.
Sep 20, 2013 at 9:10 PM
Thanks a lot...missed that part. The doc is great and easy to understand...that part my eyes must have missed. Thanks again!