Check if a variable exists between two numbers with Java

I have a problem with this code:

if (90 >>= angle =<< 180)

Error explanation:

The left side of the job must be variable.

I understand what this means, but how to turn the above code into the correct code?

+6
source share
7 answers

I see some errors in your code.
It probably meant a mathematical term

90 <= angle <= 180, which means an angle in the range of 90-180.

if (angle >= 90 && angle <= 180) {

// do action
}
+35
source

Are you writing Java code for Android? in this case you should write maybe

if (90 >= angle && angle <= 180) {

updating the code to a more pleasant style (as some suggested), you will get:

if (angle <= 90 && angle <= 180) {

, , , , < >

if (angle >= 90 && angle <= 180) {
+2

<<= +=, . x <<= 1 x = x << 1. 90 >>= angle . , , Java , , . if (x == 0 || 1), .

+2
//If "x" is between "a" and "b";

.....

int m = (a+b)/2;

if(Math.abs(x-m) <= (Math.abs(a-m)))

{
(operations)
}

......

// , ;

:

//if x is between 10 and 20

if(Math.abs(x-15)<=5)
+1
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

+1

, Java, :

if (90 >= angle  &&  angle <= 180 )  {

(Do not you mean that less than 90 angleIf yes: 90 <= angle)

0
source

All Articles