Snap! custom block to reverse a list
✓ Published0🌍 Public
CCliffordAnderson
Last edited Mar 18, 2018
Created on Mar 18, 2018
This example shows a Snap! custom block that reverses a list, reporting the reversed list as its output. The block first determines the list’s length and creates an empty list for the result. It then uses a `doUntil` loop that, while the length is not zero, appends the item at the current index to the result and decrements the length. The code relies on Snap! list primitives such as `reportListLength`, `reportListItem`, and `doAddToList`, with the original list passed in as an argument.
AI-generated description