• Can you try updating the NPM package? It seems it was a little bit behind the IDE (I've just published a new version) and a bug had got introduced to do with the line numbering a while back.

    I just tried the code you posted here with the new version and it seems to work ok.

    It's worth noting that if you paste the IF statement you've shown on the left-hand side of the IDE (or in interactive mode using the CLI) then it'll still fail with the same error - because when you hit 'enter' before the else Espruino has no way of knowing that is hadn't seen a complete statement that it should execute.

    When working correctly the CLI tries to detect code like that and rewrites the Carriage Return as a different set of characters which tells Espruino to add a newline but without executing.

About

Avatar for Gordon @Gordon started