March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
1
Task/Enumerations/Bracmat/enumerations.bracmat
Normal file
1
Task/Enumerations/Bracmat/enumerations.bracmat
Normal file
|
|
@ -0,0 +1 @@
|
|||
fruits=apple+banana+cherry;
|
||||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
var fruits = { apple : 0, banana : 1, cherry : 2 };
|
||||
var fruits = { APPLE : 0, BANANA : 1, CHERRY : 2 };
|
||||
Object.freeze(fruits);
|
||||
|
|
|
|||
5
Task/Enumerations/Rust/enumerations.rust
Normal file
5
Task/Enumerations/Rust/enumerations.rust
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
enum Fruits {
|
||||
Apple,
|
||||
Banana,
|
||||
Cherry
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue