Range in if loop

is this correct to put range in if order?
if ( t<30 && t>20)
{
}
is this code right?

Hi @hadimargo .

To loop this interval it needs to look like this:

while (t<30 &&t>20)
{
}

RV mineirin

Your if statement (there is no such thing as an if loop) says

If the value of t is less than 30 and the the value of t is greater than 20 then run the code in the following code block. It is a valid test if that is the range of values that you want to test for

Do you have a problem testing for ranges of values ?

Except that loop will never end as it is currently written

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.