Enumerations: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
Line 2,179:
 
The only way to give such a variable a value without setting it explicitly is to add one to the previous such variable which (in effect) is what a C-style enum does. If you declare a variable in Wren without giving it a value, then it is set to the special value ''null'' which is no help here.
<syntaxhighlight lang="ecmascriptwren">var APPLE = 1
var ORANGE = 2
var PEAR = 3
Line 2,197:
<br>
{{libheader|Wren-dynamic}}
<syntaxhighlight lang="ecmascriptwren">import "./dynamic" for Enum
 
var Fruit = Enum.create("Fruit", ["apple", "orange", "pear", "cherry", "banana", "grape"], 1)
9,477

edits