[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enum and named sets


On 12/8/25 2:54 AM, Fabien Bodard wrote:
Private ThisSetName As Collection = ["this_set_name  none":0,"fast":1, "slow":2,"red":3,"green":4]

dim setcounter[] as new integer[ThisSetName!5]
inc setcounter[ThisSetName!none]
inc setcounter[ThisSetName!green]

  for each xx as variant in ThisSetName
   print setcounter[xx]
  next


and in your case

for i = 0 to 4
print setcounter[i]
next

I don't understand that code, Fabien.

When I run it, the line with "dim setcounter[] as new integer[ThisSetName!5]" produces an error:
"Embedded arrays are forbidden here"

If I try "Print ThisSetName!5", I get the error:
"The '!' operator must be followed by an identifier"

And, why is the first key of the Collection "this_set_name  none"? This makes the key "ThisSetName!none" have a Null value.


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


References:
enum and named setsBrian G <brian@xxxxxxxxxxxxxxxx>
Re: enum and named setsBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: enum and named setsFabien Bodard <gambas.fr@xxxxxxxxx>