if statement

Hi,

I tried this code but it is not working. How can I implement a double condition (for if)?

if (reynolds < 2.0e5 ) & (reynolds > 100.0 )
  {
     const_n = 0.6;
     const_c = 0.402;
  }
  else
  {
     const_n = 0.84;
     const_c = 0.022;
  }

Thank you

Hooky
hookyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
KangaRooConnect With a Mentor Commented:
if (reynolds < 2.0e5  && reynolds > 100.0 )
  {
     const_n = 0.6;
     const_c = 0.402;
  }
  else
  {
     const_n = 0.84;
     const_c = 0.022;
  }

0
 
myokomizCommented:
Hi Hooky,
Have you tried to split your double condition into two single conditions ?
Just for debbuging ...
0
 
KangaRooCommented:
You rcode was essentially:

  if (expr1) & (expr2) statement;

Which the compiler sees as
  if expr1 is true take_addres(expr2) statement ---> error!!

Secondly, I suspect you wanted a logical and and not a bitwise. The operator for logical and is &&
0
 
hookyAuthor Commented:
Thank you
0
All Courses

From novice to tech pro — start learning today.