nand2tetris / web-ide

A web-based IDE for https://nand2tetris.org
https://nand2tetris.github.io/web-ide
Other
65 stars 17 forks source link

[bug]: True is false? #365

Closed Arcadonauts closed 3 months ago

Arcadonauts commented 3 months ago

Tool

Jack Compiler

Interface

Website (https://nand2tetris.github.io/web-ide)

Contact Details

No response

What happened?

Might be a misunderstanding on my part, but true doesn't behave the way I expected it to:

    do Output.printString("TRUE");
}else{
    do Output.printString("FALSE");
}
return ;

This prints FALSE.

I believe that this is because true = 1 whereas it should(?) be true = -1.

Additional Comments

This code:

do Output.moveCursor(10, 1);
do Output.printString("true:");
do Output.printInt(true);

do Output.moveCursor(11, 1);
do Output.printString(" 0<1:");
do Output.printInt(0<1);

do Output.moveCursor(12, 1);
do Output.printString("  -1:");
do Output.printInt(-1);

do Output.moveCursor(13, 1);
do Output.printString("  ~1:");
do Output.printInt(~1);

return;

Produces: true_is_false

Which, even taking into account the missing - and ~ (as mentioned here: https://github.com/nand2tetris/web-ide/issues/364#issue-2344239286) isn't what I'd expect.

Do you want to try to fix this bug?

Code of Conduct