0

I'm making an if statement in objective c and would like to know if it's possible to test if a variable is not in the range of value x and value y. For example, something that goes along the lines of:

// test if float variable (called varFloat) is not in between 10.5 and 30.5

If (10.5 <! varFloat <! 30.5) {
      doStuff();
}

I tried that code above and it doesn't seem to work, and I'm not even sure if the <! operator exits. Any help is much appreciated. Thanks!

1 Answer 1

3

Sure, a value is not in a range if it is less than the lower bound or greater than the upper bound.

if ( var < x || var > y )

You might find a list of operator in C and C++ useful.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.