Defining array in switch case I’m completely new to arduino, so be polite. I’m trying to program my esp32 to drive neopixels as seven segment display. So I take a digit and pass it to switch case and in switch case I mention which led number should be lit.
`

function showDigits(digit){

switch(digit){

 case 1:
   int a[]={1,3,4,.....};
  break;

 case 2:
    int a[]={1,3,4,6,8,...};
   break;
  .
  .
  .
default:
   int a[]={1,2,3,4,5,6,7,8,9,....};
  } 
}


Now this is throwing multiple errors including redeclare of array a in same scope. Is there any better way to code this?
If you want to declare multiple variables with the same name inside different case statements, you can enclose the code inside each of them inside curly braces:

case 1:{
    Code...
break;}
case 2:
...


The curly braces will set the limits for the variables scope to just this case.