How to decrement a variable in every line of a loop..?

I want to decrement a variable after every line in a loop.
Basically the loop lines are pulling data from firebase, and it takes around 1 to 2 seconds to pull each data and till that time the loop pauses in that line. After every data is pulled I want to show in the lcd "the number of files left to be downloaded"

The number of lines are will vary.

To show what I want to do I have attached the loop below.

if(pull_data == true){
      lcd.setCursor(0,0);   lcd.print("copying data...");
      reg_morning_hour_on = firebase.getInt("test/default_time/morning/def_morning_hour_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 19  ");
      reg_morning_min_on = firebase.getInt("test/default_time/morning/def_morning_min_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 18  ");
      reg_morning_hour_off = firebase.getInt("test/default_time/morning/def_morning_hour_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 17  ");
      reg_morning_min_off = firebase.getInt("test/default_time/morning/def_morning_min_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 16  ");

      reg_noon_hour_on = firebase.getInt("test/default_time/noon/def_noon_hour_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 15  ");
      reg_noon_min_on = firebase.getInt("test/default_time/noon/def_noon_min_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 14  ");
      reg_noon_hour_off = firebase.getInt("test/default_time/noon/def_noon_hour_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 13  ");
      reg_noon_min_off = firebase.getInt("test/default_time/noon/def_noon_min_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 12  ");

      reg_afternoon_hour_on = firebase.getInt("test/default_time/afternoon/def_afternoon_hour_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 11  ");
      reg_afternoon_min_on = firebase.getInt("test/default_time/afternoon/def_afternoon_min_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 10  ");
      reg_afternoon_hour_off = firebase.getInt("test/default_time/afternoon/def_afternoon_hour_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 9   ");
      reg_afternoon_min_off = firebase.getInt("test/default_time/afternoon/def_afternoon_min_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 8   ");

      reg_evening_hour_on = firebase.getInt("test/default_time/evening/def_evening_hour_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 7   ");
      reg_evening_min_on = firebase.getInt("test/default_time/evening/def_evening_min_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 6   ");
      reg_evening_hour_off = firebase.getInt("test/default_time/evening/def_evening_hour_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 5   ");
      reg_evening_min_off = firebase.getInt("test/default_time/evening/def_evening_min_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 4   ");

      reg_night_hour_on = firebase.getInt("test/default_time/night/def_night_hour_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 3   ");
      reg_night_min_on = firebase.getInt("test/default_time/night/def_night_min_on");
      lcd.setCursor(0,1);   lcd.print("Files left: 2   ");
      reg_night_hour_off = firebase.getInt("test/default_time/night/def_night_hour_off");
      lcd.setCursor(0,1);   lcd.print("Files left: 1   ");
      reg_night_min_off = firebase.getInt("test/default_time/night/def_night_min_off");
      lcd.clear();
      lcd.setCursor(0,0); lcd.print("Saving files..");

declare
int i = 0;
after every read,
i++;

and do note, you could use the number as the value to be displayed in your print statements, to keep things synchronized.

Sorry, you said incremented, but it looks like you want to decrement it, so initialize it to the number of files to be read, and then
i--; after every read.

that's a mistake.
Just corrected it.

int filesLeft;

int getData(char * s) {
  char buffer[17];
  sprintf(buffer, "Files left: %2d", filesLeft--);
  lcd.setCursor(0,1);
  lcd.print(buffer);
  return firebase.getInt(s);
}
...
  if(pull_data == true){
      lcd.setCursor(0,0);   lcd.print("copying data...");
      filesLeft = 19;
      reg_morning_hour_on = getData("test/default_time/morning/def_morning_hour_on");
      ...
      reg_night_min_off = getData("test/default_time/night/def_night_min_off");
      lcd.clear();
      lcd.setCursor(0,0); lcd.print("Saving files..");

Please explain this part.. I am unable to make out..

The number of data to be pulled from firebase is also variable. Is there any way to get the number of data to be pulled..? so that I can set the "filesleft =" to decrement.

It's a function created to remove all that duplication in your original code.

But the results are assigned to 20 separate variables in your code. If there are only 19 values to be pulled, the 20th variable will not get a value. If there are 21 values to be pulled, where will the 21st value be assigned?

sometimes I will pull 200 data and sometimes 250.. this will vary from 200 to 400 data.
Though I can calculate it out from the code in a long way.

Do you honestly think you'll do that by the method you posted in #1? Cloning lines and monotonously typing all those numbers in? A function that pulls a single item, a print statement that prints the number, in a loop that counts the items is how to do it.

How will these 400 values be assigned to your 20 variables?

I have just shared a part of the data I am pulling for testing purpose..

Ok, what determines the number of values that will be pulled? Firebase? The Arduino?

If Firebase determines the number of values, how will your Arduino code know how many should be pulled?

Just changed my mind.. I will pull all the 400 data.
Not making it variable..

But if it was variable, It would be Arduino.

Ok, so you plan to declare 400 variables in your arduino code to hold these 400 values, and write 400 lines of code to pull them? Can you think of a better way?

These are 400 different time variables. Nothing better is coming in my mind..

Someone please explain how this works..
I am not being able to understand this..

When the int getData has char * s within braces, what does it mean..? I have never used it in my code..

I have to save them Into eeprom too..
Also I am doing calculations with every data..

These are basically timer time variables..

Can you show me an example please..?

Below is the total number of variables that I will read from firebase and write to the eeprom

eep.write(1, reg_morning_hour_on);	  eep.write(6, reg_morning_hour_off);	  eep.write(11, reg_morning_min_on);	  eep.write(16, reg_morning_min_off);
eep.write(2, reg_noon_hour_on);	      eep.write(7, reg_noon_hour_off);	    eep.write(12, reg_noon_min_on);	      eep.write(17, reg_noon_min_off);
eep.write(3, reg_afternoon_hour_on);	eep.write(8, reg_afternoon_hour_off);	eep.write(13, reg_afternoon_min_on);	eep.write(18, reg_afternoon_min_off);
eep.write(4, reg_evening_hour_on);	  eep.write(9, reg_evening_hour_off);	  eep.write(14, reg_evening_min_on);	  eep.write(19, reg_evening_min_off);
eep.write(5, reg_night_hour_on);	    eep.write(10, reg_night_hour_off);	  eep.write(15, reg_night_min_on);	    eep.write(20, reg_night_min_off);


eep.write(21, day1_active);	eep.write(22, day2_active);	eep.write(23, day3_active);	eep.write(24, day4_active);	  eep.write(25, day5_active);	  eep.write(26, day6_active);	
eep.write(27, day7_active);	eep.write(28, day8_active);	eep.write(29, day9_active);	eep.write(30, day10_active);	eep.write(31, day11_active);	eep.write(32, day12_active);


eep.write(33, day1_t1_active);	eep.write(45,  day1_t2_active); 	eep.write(57,  day1_t3_active); 	eep.write(69,  day1_t4_active); 	eep.write(81,  day1_t5_active);
eep.write(34, day2_t1_active);	eep.write(46,  day2_t2_active); 	eep.write(58,  day2_t3_active); 	eep.write(70,  day2_t4_active); 	eep.write(82,  day2_t5_active);
eep.write(35, day3_t1_active);	eep.write(47,  day3_t2_active); 	eep.write(59,  day3_t3_active); 	eep.write(71,  day3_t4_active); 	eep.write(83,  day3_t5_active);
eep.write(36, day4_t1_active);	eep.write(48,  day4_t2_active); 	eep.write(60,  day4_t3_active); 	eep.write(72,  day4_t4_active); 	eep.write(84,  day4_t5_active);
eep.write(37, day5_t1_active);	eep.write(49,  day5_t2_active); 	eep.write(61,  day5_t3_active); 	eep.write(73,  day5_t4_active); 	eep.write(85,  day5_t5_active);
eep.write(38, day6_t1_active);	eep.write(50,  day6_t2_active); 	eep.write(62,  day6_t3_active); 	eep.write(74,  day6_t4_active); 	eep.write(86,  day6_t5_active);
eep.write(39, day7_t1_active);	eep.write(51,  day7_t2_active); 	eep.write(63,  day7_t3_active); 	eep.write(75,  day7_t4_active); 	eep.write(87,  day7_t5_active);
eep.write(40, day8_t1_active);	eep.write(52,  day8_t2_active); 	eep.write(64,  day8_t3_active); 	eep.write(76,  day8_t4_active); 	eep.write(88,  day8_t5_active);
eep.write(41, day9_t1_active);	eep.write(53,  day9_t2_active); 	eep.write(65,  day9_t3_active); 	eep.write(77,  day9_t4_active); 	eep.write(89,  day9_t5_active);
eep.write(42, day10_t1_active);	eep.write(54,  day10_t2_active);	eep.write(66,  day10_t3_active);	eep.write(78,  day10_t4_active);	eep.write(90,  day10_t5_active);
eep.write(43, day11_t1_active);	eep.write(55,  day11_t2_active);	eep.write(67,  day11_t3_active);	eep.write(79,  day11_t4_active);	eep.write(91,  day11_t5_active);
eep.write(44, day12_t1_active);	eep.write(56,  day12_t2_active);	eep.write(68,  day12_t3_active);	eep.write(80,  day12_t4_active);	eep.write(92,  day12_t5_active);



eep.write(93, day1_t1_hour_on);   eep.write(153, day1_t1_min_on); 	eep.write(213, day1_t1_hour_off); 	eep.write(273, day1_t1_min_off);
eep.write(94, day1_t2_hour_on);	  eep.write(154, day1_t2_min_on); 	eep.write(214, day1_t2_hour_off); 	eep.write(274, day1_t2_min_off);
eep.write(95, day1_t3_hour_on);	  eep.write(155, day1_t3_min_on); 	eep.write(215, day1_t3_hour_off); 	eep.write(275, day1_t3_min_off);
eep.write(96, day1_t4_hour_on);	  eep.write(156, day1_t4_min_on); 	eep.write(216, day1_t4_hour_off); 	eep.write(276, day1_t4_min_off);
eep.write(97, day1_t5_hour_on);	  eep.write(157, day1_t5_min_on); 	eep.write(217, day1_t5_hour_off); 	eep.write(277, day1_t5_min_off);
eep.write(98, day2_t1_hour_on);	  eep.write(158, day2_t1_min_on); 	eep.write(218, day2_t1_hour_off); 	eep.write(278, day2_t1_min_off);
eep.write(99, day2_t2_hour_on);	  eep.write(159, day2_t2_min_on); 	eep.write(219, day2_t2_hour_off); 	eep.write(279, day2_t2_min_off);
eep.write(100, day2_t3_hour_on);	eep.write(160, day2_t3_min_on); 	eep.write(220, day2_t3_hour_off); 	eep.write(280, day2_t3_min_off);
eep.write(101, day2_t4_hour_on);	eep.write(161, day2_t4_min_on); 	eep.write(221, day2_t4_hour_off); 	eep.write(281, day2_t4_min_off);
eep.write(102, day2_t5_hour_on);	eep.write(162, day2_t5_min_on); 	eep.write(222, day2_t5_hour_off); 	eep.write(282, day2_t5_min_off);
eep.write(103, day3_t1_hour_on);	eep.write(163, day3_t1_min_on); 	eep.write(223, day3_t1_hour_off); 	eep.write(283, day3_t1_min_off);
eep.write(104, day3_t2_hour_on);	eep.write(164, day3_t2_min_on); 	eep.write(224, day3_t2_hour_off); 	eep.write(284, day3_t2_min_off);
eep.write(105, day3_t3_hour_on);	eep.write(165, day3_t3_min_on); 	eep.write(225, day3_t3_hour_off); 	eep.write(285, day3_t3_min_off);
eep.write(106, day3_t4_hour_on);	eep.write(166, day3_t4_min_on); 	eep.write(226, day3_t4_hour_off); 	eep.write(286, day3_t4_min_off);
eep.write(107, day3_t5_hour_on);	eep.write(167, day3_t5_min_on); 	eep.write(227, day3_t5_hour_off); 	eep.write(287, day3_t5_min_off);
eep.write(108, day4_t1_hour_on);	eep.write(168, day4_t1_min_on); 	eep.write(228, day4_t1_hour_off); 	eep.write(288, day4_t1_min_off);
eep.write(109, day4_t2_hour_on);	eep.write(169, day4_t2_min_on); 	eep.write(229, day4_t2_hour_off); 	eep.write(289, day4_t2_min_off);
eep.write(110, day4_t3_hour_on);	eep.write(170, day4_t3_min_on); 	eep.write(230, day4_t3_hour_off); 	eep.write(290, day4_t3_min_off);
eep.write(111, day4_t4_hour_on);	eep.write(171, day4_t4_min_on);	  eep.write(231, day4_t4_hour_off); 	eep.write(291, day4_t4_min_off);
eep.write(112, day4_t5_hour_on);	eep.write(172, day4_t5_min_on); 	eep.write(232, day4_t5_hour_off); 	eep.write(292, day4_t5_min_off);
eep.write(113, day5_t1_hour_on);	eep.write(173, day5_t1_min_on); 	eep.write(233, day5_t1_hour_off); 	eep.write(293, day5_t1_min_off);
eep.write(114, day5_t2_hour_on);	eep.write(174, day5_t2_min_on); 	eep.write(234, day5_t2_hour_off); 	eep.write(294, day5_t2_min_off);
eep.write(115, day5_t3_hour_on);	eep.write(175, day5_t3_min_on); 	eep.write(235, day5_t3_hour_off); 	eep.write(295, day5_t3_min_off);
eep.write(116, day5_t4_hour_on);	eep.write(176, day5_t4_min_on); 	eep.write(236, day5_t4_hour_off); 	eep.write(296, day5_t4_min_off);
eep.write(117, day5_t5_hour_on);	eep.write(177, day5_t5_min_on); 	eep.write(237, day5_t5_hour_off); 	eep.write(297, day5_t5_min_off);
eep.write(118, day6_t1_hour_on);	eep.write(178, day6_t1_min_on); 	eep.write(238, day6_t1_hour_off); 	eep.write(298, day6_t1_min_off);
eep.write(119, day6_t2_hour_on);	eep.write(179, day6_t2_min_on); 	eep.write(239, day6_t2_hour_off);	  eep.write(299, day6_t2_min_off);
eep.write(120, day6_t3_hour_on);	eep.write(180, day6_t3_min_on); 	eep.write(240, day6_t3_hour_off); 	eep.write(300, day6_t3_min_off);
eep.write(121, day6_t4_hour_on);	eep.write(181, day6_t4_min_on); 	eep.write(241, day6_t4_hour_off); 	eep.write(301, day6_t4_min_off);
eep.write(122, day6_t5_hour_on);	eep.write(182, day6_t5_min_on); 	eep.write(242, day6_t5_hour_off); 	eep.write(302, day6_t5_min_off);
eep.write(123, day7_t1_hour_on);	eep.write(183, day7_t1_min_on); 	eep.write(243, day7_t1_hour_off); 	eep.write(303, day7_t1_min_off);
eep.write(124, day7_t2_hour_on);	eep.write(184, day7_t2_min_on); 	eep.write(244, day7_t2_hour_off);	  eep.write(304, day7_t2_min_off);
eep.write(125, day7_t3_hour_on);	eep.write(185, day7_t3_min_on); 	eep.write(245, day7_t3_hour_off);	  eep.write(305, day7_t3_min_off);
eep.write(126, day7_t4_hour_on);	eep.write(186, day7_t4_min_on); 	eep.write(246, day7_t4_hour_off);	  eep.write(306, day7_t4_min_off);
eep.write(127, day7_t5_hour_on);	eep.write(187, day7_t5_min_on); 	eep.write(247, day7_t5_hour_off);	  eep.write(307, day7_t5_min_off);
eep.write(128, day8_t1_hour_on);	eep.write(188, day8_t1_min_on); 	eep.write(248, day8_t1_hour_off);	  eep.write(308, day8_t1_min_off);
eep.write(129, day8_t2_hour_on);	eep.write(189, day8_t2_min_on); 	eep.write(249, day8_t2_hour_off); 	eep.write(309, day8_t2_min_off);
eep.write(130, day8_t3_hour_on);	eep.write(190, day8_t3_min_on); 	eep.write(250, day8_t3_hour_off);	  eep.write(310, day8_t3_min_off);
eep.write(131, day8_t4_hour_on);	eep.write(191, day8_t4_min_on);	  eep.write(251, day8_t4_hour_off);	  eep.write(311, day8_t4_min_off);
eep.write(132, day8_t5_hour_on);	eep.write(192, day8_t5_min_on);	  eep.write(252, day8_t5_hour_off);	  eep.write(312, day8_t5_min_off);
eep.write(133, day9_t1_hour_on);	eep.write(193, day9_t1_min_on);	  eep.write(253, day9_t1_hour_off); 	eep.write(313, day9_t1_min_off);
eep.write(134, day9_t2_hour_on);	eep.write(194, day9_t2_min_on);	  eep.write(254, day9_t2_hour_off); 	eep.write(314, day9_t2_min_off);
eep.write(135, day9_t3_hour_on);	eep.write(195, day9_t3_min_on);	  eep.write(255, day9_t3_hour_off); 	eep.write(315, day9_t3_min_off);
eep.write(136, day9_t4_hour_on);	eep.write(196, day9_t4_min_on);	  eep.write(256, day9_t4_hour_off); 	eep.write(316, day9_t4_min_off);
eep.write(137, day9_t5_hour_on);	eep.write(197, day9_t5_min_on);	  eep.write(257, day9_t5_hour_off); 	eep.write(317, day9_t5_min_off);
eep.write(138, day10_t1_hour_on);	eep.write(198, day10_t1_min_on);	eep.write(258, day10_t1_hour_off);	eep.write(318, day10_t1_min_off);
eep.write(139, day10_t2_hour_on);	eep.write(199, day10_t2_min_on);	eep.write(259, day10_t2_hour_off);	eep.write(319, day10_t2_min_off);
eep.write(140, day10_t3_hour_on);	eep.write(200, day10_t3_min_on);	eep.write(260, day10_t3_hour_off);	eep.write(320, day10_t3_min_off);
eep.write(141, day10_t4_hour_on);	eep.write(201, day10_t4_min_on);	eep.write(261, day10_t4_hour_off);	eep.write(321, day10_t4_min_off);
eep.write(142, day10_t5_hour_on);	eep.write(202, day10_t5_min_on);	eep.write(262, day10_t5_hour_off);	eep.write(322, day10_t5_min_off);
eep.write(143, day11_t1_hour_on);	eep.write(203, day11_t1_min_on);	eep.write(263, day11_t1_hour_off);	eep.write(323, day11_t1_min_off);
eep.write(144, day11_t2_hour_on);	eep.write(204, day11_t2_min_on);	eep.write(264, day11_t2_hour_off);	eep.write(324, day11_t2_min_off);
eep.write(145, day11_t3_hour_on);	eep.write(205, day11_t3_min_on);	eep.write(265, day11_t3_hour_off);	eep.write(325, day11_t3_min_off);
eep.write(146, day11_t4_hour_on);	eep.write(206, day11_t4_min_on);	eep.write(266, day11_t4_hour_off);	eep.write(326, day11_t4_min_off);
eep.write(147, day11_t5_hour_on);	eep.write(207, day11_t5_min_on);	eep.write(267, day11_t5_hour_off);	eep.write(327, day11_t5_min_off);
eep.write(148, day12_t1_hour_on);	eep.write(208, day12_t1_min_on);	eep.write(268, day12_t1_hour_off);	eep.write(328, day12_t1_min_off);
eep.write(149, day12_t2_hour_on);	eep.write(209, day12_t2_min_on);	eep.write(269, day12_t2_hour_off);	eep.write(329, day12_t2_min_off);
eep.write(150, day12_t3_hour_on);	eep.write(210, day12_t3_min_on);	eep.write(270, day12_t3_hour_off);	eep.write(330, day12_t3_min_off);
eep.write(151, day12_t4_hour_on);	eep.write(211, day12_t4_min_on);	eep.write(271, day12_t4_hour_off);	eep.write(331, day12_t4_min_off);
eep.write(152, day12_t5_hour_on);	eep.write(212, day12_t5_min_on);	eep.write(272, day12_t5_hour_off);	eep.write(332, day12_t5_min_off);


eep.write(333, day1_date);	eep.write(345, day1_month); 	eep.write(357, day1_year);
eep.write(334, day2_date);	eep.write(346, day2_month); 	eep.write(358, day2_year);
eep.write(335, day3_date);	eep.write(347, day3_month); 	eep.write(359, day3_year);
eep.write(336, day4_date);	eep.write(348, day4_month); 	eep.write(360, day4_year);
eep.write(337, day5_date);	eep.write(349, day5_month); 	eep.write(361, day5_year);
eep.write(338, day6_date);	eep.write(350, day6_month); 	eep.write(362, day6_year);
eep.write(339, day7_date);	eep.write(351, day7_month); 	eep.write(363, day7_year);
eep.write(340, day8_date);	eep.write(352, day8_month); 	eep.write(364, day8_year);
eep.write(341, day9_date);	eep.write(353, day9_month);	  eep.write(365, day9_year);
eep.write(342, day10_date);	eep.write(354, day10_month);	eep.write(366, day10_year);
eep.write(343, day11_date);	eep.write(355, day11_month);	eep.write(367, day11_year);
eep.write(344, day12_date);	eep.write(356, day12_month);	eep.write(368, day12_year);

I do not know about enum,
Unable to find proper reference for enum to understand how it works too.