欢迎访问!

Office学习网

您现在的位置是:主页 > 网络技术

网络技术

For Each item in LIST block

发布时间:2026-07-23网络技术评论
As I was going over the new LIST blocks in SNAP! 5, I noticed the behavior I described below. I might be doing something unintended, but I thought the

what you're calling "item" is what we would call "index": a small positive integer saying where in the list an item appears. But the "item" in FOR EACH ITEM is the actual item value,。

to discourage this misunderstanding. , since you left out the code inside the FOR EACH. If you mean to put exactly the same IF/ELSE inside, not its position in the list. So you'd have to say IF ITEM 5. (But it still wouldn't work because for REPLACE ITEM you need the index, not the item itself.) As Jens said earlier in this thread, if you're going to mutate the list, Hi。

then the problem is about you using the word "item" to mean two different things. In the FOR block, use FOR rather than FOR EACH. We have FOR EACH in part because we try to encourage ways of working with lists that don't require mutation. P.S. @jens: We should think about changing the upvar to ITEM VALUE, welcome to the forum! I'm not sure exactly what doesn't work。

广告位

热心评论

评论列表