Empty string not equal to empty string?

I think I've encountered a Snap! bug hopefully it's not me being dumb but I've double checked it 10 times so it's probably not me misinterpreting it. I've encountered this bug in this project:

In the "compile" block, I check if a possibly 3 or 4 item list contains an item 4 by checking if item 4 is an empty string. But for some reason if item 4 is an empty string, and I check if it is an empty string by comparing it to an empty string, it returns false.

Currently I made it so when you run the "compile" block, when it needs to make a block it:

  1. Says the block data list
  2. Says if item 4 of the list is equal to an empty string
  3. Says item 4 of the list

After each step it pauses the project so you can read the text bubble. I did this for debugging purposes. Here is what the code looks like:

When you run it, it should first say the block data for the goto x, y block because that is the first line of code it tries to compile. So it would go something like this:

  1. image
  2. image
  3. (says nothing)

I'm using a Windows 10 on the Chrome browser

You say its a possible 3 or 4 item long list but you don't check the length before trying to access item 4
So you might be trying to read beyond the end of the list
Probably not your issue but that needs fixing first I'd thought

First i run this:


I test the type of the reporter just for info:
It's a text but Null because item 4 does'nt exist in this list...

No problem here:

Win 7
Chrome Version 87.0.4280.141 (Build officiel) (32 bits)

No problem here

Yes, I know that I may be reading beyond the end of the list. But if I am, then item 4 would be nothing. I made it so if item 4 is nothing, then it would do something else unrelated to item 4. That's why I check if item 4 is an empty string. Also now, because of this bug, I just made it check if the length of the item is less than 4 instead.

Also @loucheman I did those tests too before (except without checking if it's a text and the list wasn't stored in a variable), and they returned the same results. I have no idea why it's returning false for that specific situation.

Yeah the thing is, that code is inside a higher order command (for each item) and so empty slots are replaced by the item, same as in the higher order functions. To avoid that you'll have to do

(I didn't bother renaming the input to the ring because you won't actually use it. But having it there prevents substitution into empty input slots.)


(sentence to bypass 5 character limit without adding any more meaningful information because i only feel the need to acknowledge that i read what you wrote and i have nothing else to say but that)



there should be an FAQ about this. it has already come up twice.