Enumerations: Difference between revisions
Content added Content deleted
(→{{header|Diego}}: Added Diego entry) |
m (→{{header|Diego}}: Added `flag` enumeration) |
||
Line 550: | Line 550: | ||
Without explicit values (and dynamic typing): |
Without explicit values (and dynamic typing): |
||
<lang Diego>add_enum(fruits,⟦apple,banana,cherry⟧);</lang> |
<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}}== |
=={{header|DWScript}}== |