March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -0,0 +1 @@
fruits=apple+banana+cherry;

View file

@ -1,17 +1,17 @@
// Anonymous
enum { APPLE, BANANA, CHERRY }
// Named (commonlu used enum in D) (uint)
// Named (commonly used enum in D) (int).
enum Fruits1 { apple, banana, cherry }
// Named with specified values (uint)
// Anonymous, as in C.
enum { APPLE, BANANA, CHERRY }
// Named with specified values (int).
enum Fruits2 { apple = 0, banana = 10, cherry = 20 }
// Named, typed and with specified values
// Named, typed and with specified values.
enum Fruits3 : ubyte { apple = 0, banana = 100, cherry = 200 }
void main() {
static assert(CHERRY == 2);
int f1 = Fruits2.banana; // No error
// Fruits2 f2 = 1; // Compilation error
int f1 = Fruits2.banana; // No error.
// Fruits2 f2 = 1; // Error: cannot implicitly convert.
}

View file

@ -1 +1,2 @@
var fruits = { apple : 0, banana : 1, cherry : 2 };
var fruits = { APPLE : 0, BANANA : 1, CHERRY : 2 };
Object.freeze(fruits);

View file

@ -0,0 +1,5 @@
enum Fruits {
Apple,
Banana,
Cherry
}