A variable can never be a literal number or begin with a digit (or sign or...) or be one of the language reserved words. So it is not an IDE thing, it is a language thing, and the IDE is so helpful to point the coding mistake out. Make it var v1 = false; or var v2 = false; - or even much better - some 'speaking' name, such as: var led1State = false;. Since long names eat up precious space / available RAM - though Pico has (much) more of that than the original board - you may end up (far down the lane) with something along the lines: l1S, but do not do that in the beginning. And there are even tools out there that minify - shrink wrap - the code for runtime: while coding/in source, the code is very human readable, and when uploaded and executed, it is extremely terse (some minifier replace then the variable names with _0, _1, _2,... , _a, _b, ..., _10, _11,... _0a, _0b, etc).
PS: After reading your post and watching the video a second time closely, I notice, that you did not replace the 1 (one) with a 1 (one), you replaced the letter l (for led) with number 1. . Line 3 and 4 they all use letter l. If you change it there as well to one, IDE will complain there as well. I'm saddened(***) by font selections insensitive to this issue... sorry @Gordon for this rant - and for that one too: even though the forum does a mixed-better job with letter l and digit 1 - l1, l1,
l1
, it could do a better job with the o letters and 0 (zero) digit: Oo0, Oo0, and
Oo0
, it could be more pronounced. That's why the
code format
is there to avoid any ambiguity - more so for o and 0 with the dot in the center, a bit less the l and 1.
(****) After being wasted over and over by similar font selections in the past, the politically correct I'm saddened feels more like I 'hate' insensitive font selection... nevertheless, for both you need a shrink to fix-ya, but with the latter you are left alone and get no empathy...
Understanding now the challenge, I suggest that you - @JackJamesHoward - change the conversation title to - for example - Watch out, 1 (number/digit) looks like l (letter), but they are really not the same! - Mr Obvious ;-) - and it will become a great help for many others...
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.
A variable can never be a literal number or begin with a digit (or sign or...) or be one of the language reserved words. So it is not an IDE thing, it is a language thing, and the IDE is so helpful to point the coding mistake out. Make it
var v1 = false;
orvar v2 = false;
- or even much better - some 'speaking' name, such as:var led1State = false;
. Since long names eat up precious space / available RAM - though Pico has (much) more of that than the original board - you may end up (far down the lane) with something along the lines:l1S
, but do not do that in the beginning. And there are even tools out there that minify - shrink wrap - the code for runtime: while coding/in source, the code is very human readable, and when uploaded and executed, it is extremely terse (some minifier replace then the variable names with _0, _1, _2,... , _a, _b, ..., _10, _11,... _0a, _0b, etc).PS: After reading your post and watching the video a second time closely, I notice, that you did not replace the 1 (one) with a 1 (one), you replaced the letter l (for led) with number 1. . Line 3 and 4 they all use letter l. If you change it there as well to one, IDE will complain there as well. I'm saddened(***) by font selections insensitive to this issue... sorry @Gordon for this rant - and for that one too: even though the forum does a mixed-better job with letter l and digit 1 - l1,
l1
,, it could do a better job with the o letters and 0 (zero) digit: Oo0,
Oo0
, and, it could be more pronounced. That's why the
is there to avoid any ambiguity - more so for o and 0 with the dot in the center, a bit less the l and 1.
(****) After being wasted over and over by similar font selections in the past, the politically correct I'm saddened feels more like I 'hate' insensitive font selection... nevertheless, for both you need a shrink to fix-ya, but with the latter you are left alone and get no empathy...
Understanding now the challenge, I suggest that you - @JackJamesHoward - change the conversation title to - for example - Watch out, 1 (number/digit) looks like l (letter), but they are really not the same! - Mr Obvious ;-) - and it will become a great help for many others...
2 Attachments