September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
18
Task/Enumerations/BASIC/enumerations-2.basic
Normal file
18
Task/Enumerations/BASIC/enumerations-2.basic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
' Enumerations
|
||||
' Start at zero
|
||||
ENUM
|
||||
cat, dog, parrot
|
||||
END ENUM
|
||||
PRINT "Dogs are #", dog
|
||||
|
||||
' Set value
|
||||
ENUM
|
||||
Sunday=1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
|
||||
END ENUM
|
||||
PRINT Sunday, " ", Wednesday, " ", Saturday
|
||||
|
||||
' Change values, ENUM names must be unique
|
||||
ENUM
|
||||
sunday=7, monday=1, tuesday, wednesday, thursday, friday, saturday
|
||||
END ENUM
|
||||
PRINT sunday, " ", wednesday, " ", saturday
|
||||
|
|
@ -1,2 +1,7 @@
|
|||
var fruits = { APPLE : 0, BANANA : 1, CHERRY : 2 };
|
||||
Object.freeze(fruits);
|
||||
// enum fruits { apple, banana, cherry }
|
||||
|
||||
var f = "apple";
|
||||
|
||||
if(f == "apple"){
|
||||
f = "banana";
|
||||
}
|
||||
|
|
|
|||
1
Task/Enumerations/Julia/enumerations.julia
Normal file
1
Task/Enumerations/Julia/enumerations.julia
Normal file
|
|
@ -0,0 +1 @@
|
|||
@enum Fruits APPLE BANANA CHERRY
|
||||
15
Task/Enumerations/Kotlin/enumerations.kotlin
Normal file
15
Task/Enumerations/Kotlin/enumerations.kotlin
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// version 1.0.5-2
|
||||
|
||||
enum class Animals {
|
||||
CAT, DOG, ZEBRA
|
||||
}
|
||||
|
||||
enum class Dogs(val id: Int) {
|
||||
BULLDOG(1), TERRIER(2), WOLFHOUND(4)
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
for (value in Animals.values()) println("${value.name.padEnd(5)} : ${value.ordinal}")
|
||||
println()
|
||||
for (value in Dogs.values()) println("${value.name.padEnd(9)} : ${value.id}")
|
||||
}
|
||||
19
Task/Enumerations/PureBasic/enumerations-4.purebasic
Normal file
19
Task/Enumerations/PureBasic/enumerations-4.purebasic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
;This starts the enumeration of a named group 'NamedGroup'.
|
||||
Enumeration NamedGroup 5
|
||||
#Green ; 5
|
||||
#Orange ; 6
|
||||
EndEnumeration
|
||||
|
||||
;EnumerationBinary will use values that are a double of the previous value (or starting value).
|
||||
EnumerationBinary
|
||||
#North ; 1
|
||||
#West ; 2
|
||||
#South ; 4
|
||||
#East ; 8
|
||||
EndEnumeration
|
||||
|
||||
;This continues the enumeration of the previously named group 'NamedGroup'.
|
||||
Enumeration NamedGroup
|
||||
#Yellow ; 7
|
||||
#Red ; 8
|
||||
EndEnumeration
|
||||
6
Task/Enumerations/Zkl/enumerations-1.zkl
Normal file
6
Task/Enumerations/Zkl/enumerations-1.zkl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const RGB_COLOR{ // put color names in a name space
|
||||
const RED =0xf00;
|
||||
const BLUE=0x0f0, GREEN = 0x00f;
|
||||
const CYAN=BLUE + GREEN; // → 0x0ff
|
||||
}
|
||||
println(RGB_COLOR.BLUE);
|
||||
4
Task/Enumerations/Zkl/enumerations-2.zkl
Normal file
4
Task/Enumerations/Zkl/enumerations-2.zkl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const X0=N; // --> 0
|
||||
const A=N,B=N,C=N; // --> 1,2,3
|
||||
const{ _n=-1; } // reset Enum, this should be a const space function
|
||||
const X=N; // -->0
|
||||
3
Task/Enumerations/Zkl/enumerations-3.zkl
Normal file
3
Task/Enumerations/Zkl/enumerations-3.zkl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#continuing ...
|
||||
z:=N; // -->2 NOT 1 as it is set AFTER Y (compile time vs parse time)
|
||||
const Y=N; // -->1! because it is set before z
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
{"fruits" : { "apple" : null, "banana" : null, "cherry" : null }
|
||||
{"fruits" : { "apple" : 0, "banana" : 1, "cherry" : 2 }
|
||||
Loading…
Add table
Add a link
Reference in a new issue