Function()

Lee Su Keat
330
Lee Su Keat  

Hi there, 


I am new to coding and still learning. 

I tried below function however it shows 'result of expression not used'. 

double NextLot()
   {
   if (OrderLots() == 0.01) 
   {NextLot() == 0.02;}
   else if(OrderLots() == 0.02)
   {NextLot() == 0.03;}
   return (OrderLots());
   }

The object is to manage the lot size. If the lot size is A, then it's B for next. 


Maybe anyone can share other function I can try? 

Thanks in advance. 

William Roeder
25364
William Roeder  
  1. {NextLot() == 0.03;}
    Do not post code that will not compile. Unless NextLot() returns a pointer or reference to a class, you can's assign to the result. What does 0.02 = 0.03 mean to you?
  2. NextLot() calls NextLot(). That is infinite recursion. Your program crashes.

  3. Create a variable, assign to the variable, return the variable.