Quote:
Originally Posted by Rapidwolve
Enum is useful because it can be used in ways like this:
PHP Code:
enum key{ F9 = 122, F10 = 123, F11 = 124 }
function onKeyPressed(code, key) { if (code in {key.F9, key.F10, key.F11}) do_something(); }
|
I didn't know it could be used that way, of course I just found out you can make assignments to the enums but that's news to me.
Of course this makes it seem more and more like an array! But easier to remember and such in the fact that it's more so, enumname.stuff rather than array[0].
Can you add things to enumerators through function?