Are dynamic variable identifiers possible and if so how?

i am trying to create 64 variables which i could create by iterating through 8 while loops only problem is that i cant find a way to give each variable in the loop a different identifier

i’ve also thought about using arrays but cant figure out how to create them in a loop

please help
note the variables are structs

Hey, welcome to Ziggit!

If you just want to create 64 instances of your struct you can reserve the memory for the array before entering your loops like this:

const S = struct { ... };

var instances: [64]S = undefined;
for (&instances) |*instance| {
    // your loops to initialize each instance
}
7 Likes