Coding error help please


#1

for some reason when I use this code
int main() {
while (true) {
bool LeftTopx=(0<Brain.Screen.xPosition()<200);
bool LeftTopy=(0<Brain.Screen.yPosition()<200);

        if (LeftTopx && LeftTopy) {
                Brain.Screen.printAt(100,100,0,"Hello");
                
            
        }

I get this error
13:07:01 – warning – In file included from cxx_entry.cpp:16:
./main.cpp:6:42: warning: comparison of constant 200 with expression of type ‘bool’ is always true -Wtautological-constant-out-of-range-compare]
bool LeftTopx=(0 ~~~~~~~~~~~~~~~~~~~~~~~~^~
./main.cpp:7:42:
13:07:01 – warning – warning: comparison of constant 200 with expression of type ‘bool’ is always true -Wtautological-constant-out-of-range-compare]
bool LeftTopy=(0 ~~~~~~~~~~~~~~~~~~~~~~~~~~

please help


#2

You need to have 2 different statements checking if it is greater than 0 and less than 200.
This should fix your problem:


int main() {
    while (true) {
        bool LeftTopx=(Brain.Screen.xPosition()>0 && Brain.Screen.xPosition()<200);
        bool LeftTopy=(Brain.Screen.yPosition()>0 && Brain.Screen.yPosition()<200);

        if (LeftTopx && LeftTopy) {
            Brain.Screen.printAt(100, 100, 0, "Hello");
        }
    }
}


#3

Ok thanks