On Thu, Feb 04, 2021 at 01:08:56PM +0000, Lance Dillon wrote:
What would be the best way to represent enums? It has been a while since I wrote pike code, so I'm looking in the docs and can't see anything. Maybe just a bunch of constants? Or maybe a class (or struct)?
I think the best enum representation would be just enum.
#v+ enum foo_t { ONE = 0, TWO = 1, THREE = 2 };
foo_t nabla = ONE;
write("ONE + TWO = THREE\n%d + %d = %d\n", ONE, TWO, THREE); #v-