Anonymous user
Enumerations: Difference between revisions
m
→{{header|Diego}}: Added `flag` enumeration
(→{{header|Diego}}: Added Diego entry) |
m (→{{header|Diego}}: Added `flag` enumeration) |
||
Line 550:
Without explicit values (and dynamic typing):
<lang Diego>add_enum(fruits,⟦apple,banana,cherry⟧);</lang>
Flag enumerations (multi-selectable enumerations) can be created using <code>enum</code>, however, there is an primitive <code>flag</code> object available. This is similar to <code>[Flags]</code> and <code><Flags> _</code> flag attributes in C# and VB.Net respectively.
<lang Diego>add_flag(ape,⟦gorilla,chimpanzee,orangutan⟧);
log_console()_(ape);</lang>
Output:
<pre>⟪1⟫,⟦gorilla⟧,⟪2⟫,⟦chimpanzee⟧,⟪4⟫,⟦orangutan⟧</pre>
=={{header|DWScript}}==
|