"Not all control paths return a value" error - page 4

 
jack zorlob: yea property stricts f sss things up...thanks

Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.

 
jack zorlob:
yea property stricts f sss things up...thanks

Use English only in the forum.
I have no idea what that means.

If you are saying that strict messes things up, you are totally wrong. Everybody should use it in their MQL4 code.

 

hello everyone
I get a "Not all control paths return a value " error
Can someone please point out the problem.

Thanks

//+------------------------------------------------------------------+
//| IsPrime Function                                                 |
//+------------------------------------------------------------------+
  int IsPrime(int n)
{
for(int i=3;i<n;i++)
   {
      if (n%i == 0)
         {
            Print("Not Prime");
         }
         else
            {
               Print("Prime");
            }
   }
}
 
Shahriar Soltani #:

hello everyone
I get a "Not all control paths return a value " error
Can someone please point out the problem.

Thanks

Solved Proble.
string Status = "not clear";
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
int number = 20;
int prime = 0 ;
int temp = 0;
IsPrime(231);

   EventSetTimer(60);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| IsPrime Function                                                 |
//+------------------------------------------------------------------+
  void IsPrime(int n)
{
for(int i=2;i<n;i++)
   {
      if (n%i == 0)
         {
            Status="Not Prime";
            break;
         }
         else
            {
               Status="Prime";
            }
   }
   
   Print(Status);

}