Misconception: Students think you can use the “item (any) of (list)” block in Snap! and Scratch to check for every item in a list, but this block actually returns a random item.
- Students often try to write something like the following to check every item in a list:
- The block above reads:
"hello" = item (any) of (list) - This will fail most of the time because any is a random item.
- The
containsblock is what students should use in order to achieve the task they are trying to complete: - The block above reads:
(list) contains "hello" - This block reports whether or not the item exists in the list. If the item if found, it reports TRUE, otherwise it will report FALSE.
- You can actually make your own version of
contains! - Here’s one way to create
containsin Snap!