Code simplification

Hello ,
Is there a way to simplify the next line :
int A2=1,A3=1,A4=1,A5=1,A6=1;
thank you.

Depending on how you are going to use it:

  • Use an array instead of different names for easier access
  • Write them not in one line but underneath each other for better visibility + it doesn’t matter, wont be slower

As @MxFxM said, you can use an array as such:

int[] numberArray = {1,1,1,1,1};

Hope that clarifies it,


1 Like

Thank you for your answers i’ll see what i can do.