- Home /
Complex inequalities?
I can use regular inequalities fine, such as "if 10 < 20", but I can't use complex inequalities like "5 < 10 < 20".
Assets/Direction.js(9,34): BCE0051: Operator '<' cannot be used with a left hand side of type 'boolean' and a right hand side of type 'int'.
There are no booleans involved...
Help, please.
Comment
Best Answer
Answer by Peter G · Aug 13, 2011 at 02:12 AM
You have to break the inequality into two separate statements.
if( 5 < 10 && 10 < 20 ) {
//&& operator- returns true if both conditions are true;
Answer by Eric5h5 · Aug 13, 2011 at 04:19 AM
There are no booleans involved...
There are, because when you do 5 < 10 < 20, the first part evaluates as a boolean, so you're trying to do "true < 20".
Your answer
Follow this Question
Related Questions
Fixing a BCE0051 error 1 Answer
< cheaper than <= ? 2 Answers
Having random operators in an equation? 1 Answer
How do I compare two binary values in Javascript? 1 Answer
Decompose Vector 1 Answer