Reducing lines on code

Hey Guys!
I´m currently learning how to code with Arduino and for one exercise, I have to simplify a code to be 24 lines or less. I have been trying for hours and I can´t get it to work :frowning:
This is the code
(I´m from México so the comments are on Spanish)


int n; //variable para contar
int estado=0; //variable para guardar lectura
int sal08=10; //variable para configurar el pin 12 como "sal08"
int sal07=9; //variable para configurar el pin 11 como "sal07"
int sal06=8; //variable para configurar el pin 10 como "sal06"
int sal05=7; //variable para configurar el pin 9 como "sal05"
int sal04=6; //variable para configurar el pin 8 como "sal04"
int sal03=5; //variable para configurar el pin 7 como "sal03"
int sal02=4; //variable para configurar el pin 6 como "sal02"
int sal01=3; //variable para configurar el pin 5 como "sal01"
int ent01=2; //variable para configurar el pin 4 como "ent01"
int ent02=1; //variable para configurar el pin 3 como "ent02"

void setup() {
// put your setup code here, to run once:
pinMode(sal08,OUTPUT); //configura la variable "sal08" como salida
pinMode(sal07,OUTPUT); //configura la variable "sal07" como salida
pinMode(sal06,OUTPUT); //configura la variable "sal06" como salida
pinMode(sal05,OUTPUT); //configura la variable "sal05" como salida
pinMode(sal04,OUTPUT); //configura la variable "sal04" como salida
pinMode(sal03,OUTPUT); //configura la variable "sal03" como salida
pinMode(sal02,OUTPUT); //configura la variable "sal01" como salida
pinMode(sal01,OUTPUT); //configura la variable "sal02" como salida
pinMode(ent01,INPUT); //configura la variable "ent01" como entrada
pinMode(ent02,INPUT); //configura la variable "ent02" como entrada
}

void loop() {
// put your main code here, to run repeatedly:
//estado=digitalRead(ent01); //lee el estado de la variable "ent01"
// if (estado==HIGH){ //si el estado es 1(High)
for (n=0;n<3;n=n+1){ //se repite por 3 veces
digitalWrite(sal01,HIGH); //se encienden los leds desde "sal01" a "sal08"
digitalWrite(sal02,HIGH);
digitalWrite(sal03,HIGH);
digitalWrite(sal04,HIGH);
digitalWrite(sal05,HIGH);
digitalWrite(sal06,HIGH);
digitalWrite(sal07,HIGH);
digitalWrite(sal08,HIGH);
delay(250); //se espera 250 milisegundos
digitalWrite(sal01,LOW); //se apagan los leds desde "sal01" a "sal08"
digitalWrite(sal02,LOW);
digitalWrite(sal03,LOW);
digitalWrite(sal04,LOW);
digitalWrite(sal05,LOW);
digitalWrite(sal06,LOW);
digitalWrite(sal07,LOW);
digitalWrite(sal08,LOW);
delay(400); //se espera 400 milisegundos
}
digitalWrite(sal01,HIGH); //se enciende el led en "sal01"
delay(400); //se espera 400 milisegundos
digitalWrite(sal02,HIGH); //se enciende el led en "sal02"
delay(400); //se espera 400 milisegundos
digitalWrite(sal03,HIGH); //se enciende el led en "sal03"
delay(400); //se espera 400 milisegundos
digitalWrite(sal04,HIGH); //se enciende el led en "sal04"
delay(400); //se espera 400 milisegundos
digitalWrite(sal05,HIGH); //se enciende el led en "sal05"
delay(400); //se espera 400 milisegundos
digitalWrite(sal06,HIGH); //se enciende el led en "sal06"
delay(400); //se espera 400 milisegundos
digitalWrite(sal07,HIGH); //se enciende el led en "sal07"
delay(400); //se espera 400 milisegundos
digitalWrite(sal08,HIGH); //se enciende el led en "sal08"
delay(400); //se espera 400 milisegundos
digitalWrite(sal01,LOW); //se apaga el led en "sal01"
delay(400); //se espera 400 milisegundos
digitalWrite(sal02,LOW); //se apaga el led en "sal02"
delay(400); //se espera 400 milisegundos
digitalWrite(sal03,LOW); //se apaga el led en "sal03"
delay(400); //se espera 400 milisegundos
digitalWrite(sal04,LOW); //se apaga el led en "sal04"
delay(400); //se espera 400 milisegundos
digitalWrite(sal05,LOW); //se apaga el led en "sal05"
delay(400); //se espera 400 milisegundos
digitalWrite(sal06,LOW); //se apaga el led en "sal06"
delay(400); //se espera 400 milisegundos
digitalWrite(sal07,LOW); //se apaga el led en "sal07"
delay(400); //se espera 400 milisegundos
digitalWrite(sal08,LOW); //se apaga el led en "sal08"
delay(400); //se espera 400 milisegundos
for (n=0;n<5;n=n+1){ //se repite por 5 veces
digitalWrite(sal01,HIGH); //se encienden los leds en "sal" impares
digitalWrite(sal02,LOW);
digitalWrite(sal03,HIGH);
digitalWrite(sal04,LOW);
digitalWrite(sal05,HIGH);
digitalWrite(sal06,LOW);
digitalWrite(sal07,HIGH);
digitalWrite(sal08,LOW);
delay(300); //se espera 300 milisegundos
digitalWrite(sal01,LOW); //se encienden los leds en "sal" pares
digitalWrite(sal02,HIGH);
digitalWrite(sal03,LOW);
digitalWrite(sal04,HIGH);
digitalWrite(sal05,LOW);
digitalWrite(sal06,HIGH);
digitalWrite(sal07,LOW);
digitalWrite(sal08,HIGH);
delay(300); //se espera 300 milisegundos
}
digitalWrite(sal01,LOW); //se apagan los leds desde "sal01" a "sal08"
digitalWrite(sal02,LOW);
digitalWrite(sal03,LOW);
digitalWrite(sal04,LOW);
digitalWrite(sal05,LOW);
digitalWrite(sal06,LOW);
digitalWrite(sal07,LOW);
digitalWrite(sal08,LOW);
}


I would like to know how to control multiple pins to have less lines
if you can help me I would be so happy THANK YOU!!!!

Use a "for (i=0; i<numPins; i++)" statement. Put the pin numbers in arrays and index them with i.

Array tutorial. If you're using the IDE then: File/examples/05.control/arrays + forLoopIteration

There's also an opportunity to learn about functions and passing parameters.

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

I have to simplify a code to be 24 lines or less

As has been suggested, using arrays is the obvious way to do this.

Actually, the question is badly worded if you have quoted it correctly, because you could put several statements on the same line and hence reduce the number of lines, but I am sure thai is not what is intended !