method void setInt(int j) {
var int result, lastDigit, g;
let length = 0;
if (j < 0) {
do appendChar(45);
}
let j = Math.abs(j);
if (j < 10) {
do appendChar(j + 48);
} else {
let result = j / 10;
let lastDigit = j - (result*10);
do setInt(result);
do appendChar(lastDigit + 48);
}
return;
}
I don't understand why if (j < 0) doesn't work. I'm trying to handle negative numbers and it works if I remove if statement, leave just do appendChar(45) or I set it in the end of the method.
See screen: 32767, should be -32767