Squirrel comparison error


#1

If I define variables like this in the beginning of my script (globals):

fcr <- 0;
hl <-11;

And then within a function I do this:

if(hl >= fcr){
// do something
}

I get a comparison error:

ERROR: comparison between ‘11’ and ‘0’

Is there some way to do a comparison between global variables?
They are both integers (not float).

If I do this ‘local’ within a function, it works without error.


#2

Seems to work fine for me? Can you post the smallest example that shows this for you?


#3

One way you might have got this error, is if fcr has in the meantime somehow been changed from an integer 0 into a string "0":

fcr <- 0;
hl <-11;

function foo() {
    if (hl >= fcr) {
         // do something
    }
}

fcr = "0";
foo();

Peter


#4

@Peter,

Thanks … that’s what it was. String variable brought in by the function. I thought it was an integer.