Skip to main content
100%

Snap! custom block to convert a string into a list of characters

✓ Published0🌍 Public
CCliffordAnderson
Last edited Mar 20, 2018
Created on Mar 20, 2018

This example shows a Snap! custom block that converts any input string into a list of its individual characters. The block, defined with the `block-definition` tag, uses a counter variable to iterate through each position of the string via `reportLetter`, adding each character to a new list with `doAddToList` until the counter matches the string’s length. It uses Snap! 4.1’s block-based API, including `doUntil` for looping and `reportStringSize` for determining the stopping condition. The accompanying XML source displays the full script and a comment explaining the block’s purpose.

AI-generated description

Similar vizzes