Why undeclared identifier in void function for Print function ?

 
Hi, 

I get undeclared indentifier for A when printing from void type. 

void down_count()
   {
   
   for (int i=0; i < 50; i++)
      {
      double histo = iCustom(NULL,0,"MACD True",2,i);
      double val1 = iFractals(NULL, 0, MODE_UPPER, i);
      
      if (histo < 0 && val1 !=0) double A = val1;
      Print(" A= ",A);
      
      }
    }

Is this because the loop has ended or because I am not allowed to print from void type like this ? 
 

You need to create a code block for the "if"  ...

void down_count()
  {
   for(int i=0; i < 50; i++)
     {
      double histo = iCustom(NULL, 0, "MACD True", 2, i);
      double val1  = iFractals(NULL, 0, MODE_UPPER, i);

      if(histo < 0 && val1 != 0)
        {
         double A = val1;
         Print(" A= ", A);
        }

     }
  }
 
Fernando Carreiro #: You need to create a code block for the "if" ...

Got it thanks, sorry for the delay.

Reason: