I have a problem with this code:
if (90 >>= angle =<< 180)
The error explanation is:
The left-hand side
I see some errors in your code.
Your probably meant the mathematical term
90 <= angle <= 180, meaning angle in range 90-180.
if (angle >= 90 && angle <= 180) {
// do action
}
//If "x" is between "a" and "b";
.....
int m = (a+b)/2;
if(Math.abs(x-m) <= (Math.abs(a-m)))
{
(operations)
}
......
//have to use floating point conversions if the summ is not even;
Simple example :
//if x is between 10 and 20
if(Math.abs(x-15)<=5)
Assuming you are programming in Java, this works:
if (90 >= angle && angle <= 180 ) {
(don't you mean 90 is less than angle
? If so: 90 <= angle
)
<<=
is like +=
, but for a left shift. x <<= 1
means x = x << 1
. That's why 90 >>= angle
doesn't parse. And, like others have said, Java doesn't have an elegant syntax for checking if a number is an an interval, so you have to do it the long way. It also can't do if (x == 0 || 1)
, and you're stuck writing it out the long way.
public static boolean between(int i, int minValueInclusive, int maxValueInclusive) {
if (i >= minValueInclusive && i <= maxValueInclusive)
return true;
else
return false;
}
https://alvinalexander.com/java/java-method-integer-is-between-a-range
are you writing java code for android? in that case you should write maybe
if (90 >= angle && angle <= 180) {
updating the code to a nicer style (like some suggested) you would get:
if (angle <= 90 && angle <= 180) {
now you see that the second check is unnecessary or maybe you mixed up <
and >
signs in the first check and wanted actually to have
if (angle >= 90 && angle <= 180) {