Part of const array with same value

Hello Zeekers,

What is the best way to represent indices of an array with the same value? Let’s say I declare a constant string array used for enumeration called ‘test’. Values 0 and 1 has some unique value, but anything from 2 and 7 has a constant value of ‘test2’. Is there a quicker way of representing this or would I need to manually set it?

const test = {
[0] = “test0”,
[1] = “test1”,

[2] = “test2”,
[3] = “test2”,

[4] = “test2”,
[5] = “test2”,

[6] = “test2”,
[7] = “test2”,
[8] = “test3”,

} &default=function(i: count):string { return fmt(“test(%x)”, i); } &redef;

Thanks,

What’s the use of this array?

My use case is for enumeration. This array is typically declared in consts.zeek; you would call it in main.zeek. I mean you could write a switch statement, but now main.zeek would definitely blow up quite a bit.

Thanks,