Why is it that I do not experience this problem with the IDE? I was under the impression that this was the same code.
Yes, it should be the same.
In fact I just tried here with your job file and it works great for me.
I think the problem is with Windows line endings in your text files? Could you check?
It appears to me that the "else on a subsequent line" is only a problem for code expanded in-line. I do not experience this issue when the code is contained in a function definition.
I can work around this issue by placing my in-line code in an IIFE:
Yes, that works fine. Or you could format your code differently, or just save it in a Unix file format for now :)
Would it make sense for espruino to wrap any code it is sending to the board in an IIFE, rather that attempting to identify/react to special cases like this?
No... The issue is that if Espruino did that, it'd have to have your entire source file in RAM at once. People routinely upload code files that are themselves bigger than Espruino's available RAM, and the only way it can handle that is by executing each individual command/declaration as it comes in.
Assuming it really is windows line endings in your file, it should be trivial to make the CLI work around it.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, it should be the same.
In fact I just tried here with your job file and it works great for me.
I think the problem is with Windows line endings in your text files? Could you check?
Yes, that's correct. Espruino Bracket counts to see if a command is finished or not. This might be some help: http://www.espruino.com/Troubleshooting#i-ve-pasted-code-into-the-left-hand-side-of-the-web-ide-and-it-doesn-t-work
Yes, that works fine. Or you could format your code differently, or just save it in a Unix file format for now :)
No... The issue is that if Espruino did that, it'd have to have your entire source file in RAM at once. People routinely upload code files that are themselves bigger than Espruino's available RAM, and the only way it can handle that is by executing each individual command/declaration as it comes in.
Assuming it really is windows line endings in your file, it should be trivial to make the CLI work around it.