Traversals

*When it says element.substring and then has index’s in the parenthesis, it only includes the first index/character.

Example” if (element.substring(0,1) ==”a”) it only inculdes character 0, not character 1. This is checking to see if the first letter of each word in the list is “a” in this example.


Types of traversal patterns:

  • List Reduce Pattern: Used to reduce information in a list to a single number, such as finding the average or smallest value3.

  • Filter Pattern: Allows users to filter a list into a new list based on specific criteria, such as length or starting letter4.