In a project I have, I defined a function that returns whether or not a button is held down (so I don't have to have "IF (BUTTON() AND #[whatever button])==#[button] THEN dowhatever" every time I get button input).
It originally went like this:
DEF BTN(B) IF (BUTTON() AND B)==B THEN RETURN 1 END (Later) PRINT BTN(#B)When I tried to run that, I would get a "type mismatch error" on the PRINT line. I wondered why and tried passing the function a string, which led to a type mismatch error not on that line but in the middle of the function. I added VAL() to it, which still led to a type mismatch error. It seemed that the function wouldn't accept integers at call, but in the function itself accepted integers only. This confused the heck out of me until I fixed it with the below:
RETURN 0(After the IF statement) I can see how that line not being there would cause error, but I don't at all see how it would cause type mismatch errors of all things. Any ideas?