They look the same,but they aren't the same

snappier os script pic (8)

This is a problem with Javascript.The typeof block is still correct though.

Why does this matter?It means when you try to get a shortcut and ditch the []==0 block you may get errors.

you put this in the tutorials category

i agree the bug is an issue, but how is what you posted a shortcut? the shortest form is just the true/false operator block, or the toggle in any boolean slot

The reason I posted this is because I used and for button press detection.But it always assumed mouse is down.The problem is that mouse state returned a string instead of a number.

shh,jens is not happy at smol bugs

Yeah, this is a longstanding bone of contention. We inherit from JS a type structure that's only semi-coherent. I have long advocated using the Scheme type system, in which everything except #F is true, including 0 and the empty list. (Historically, it took some time to get there; long ago, 0 and the empty list were also false in Scheme. I didn't like the change when it was first proposed.) But there are also things to be said for the APL type system, in which there is no Boolean type; the number 0 is false, the number 1 is true, and other values have no meaning as Booleans. The advantage of the latter system is that it becomes easy to ask questions such as "for how many items of this list is this predicate true?" You just add up ones and zeros.

What makes all this problematic for us is that we want to treat the string "0" as equal to the number 0. This is a kid-friendly world in which you never have to think about conversions between string and number. But we don't follow that rule 100%. Jens points out that doing type checking all the time would slow down Snap! programs badly; I had to fight to convince him to treat ITEM 1 OF an empty list as an error, with a meaningful error message, instead of giving a cryptic JS message. (That fight was worth having, for me, because leaving out the base case of a recursive procedure is such a common student error that I wanted a helpful error message for it.)

So, this behavior about strings is a misfeature rather than a bug, I guess. Or at least a documented bug.

Yeah,thats why I didn't submit this as a bug.Instead,I just made a tutorial so hopefully no one encounters that error