News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Enum in Positron

Started by Frizie, Jul 01, 2026, 02:49 PM

Previous topic - Next topic

Frizie

Hi Les.

I regularly write code like this:

Symbol Monday    = 1
Symbol Tuesday   = 2
Symbol Wednesday = 3
Symbol Thursday  = 4
Symbol Friday    = 5
Symbol Saturday  = 6
Symbol Sunday    = 7

Is there a way to do this sort of thing like this:

Enum 1, (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)
Ohm sweet Ohm | www.picbasic.nl

Abdullah

Hi
I would also like to know if there's a way to do this. It would make things much easier.
Best regards
Abdullah abid
Abdullah

top204

I will investigate a simplistic enum mechanism, such as the one you pseudo coded. However, in the list of values, they are not always sequential, so each one has the ability to start a new value onwards.

For example:

Enum {Monday = 1, Tuesday, Wednesday, Thursday, Friday = 8, Saturday, Sunday}

Or

Enum {
      Monday = 1,
      Tuesday,
      Wednesday,
      Thursday,
      Friday = 8,
      Saturday,
      Sunday}


Regards
Les