Overview
FOR loops enable you to iterate over collections and perform operations on each element. They are essential for batch processing, data transformation, and building complex graph structures.FOR loops are executed sequentially, making them ideal for operations that need to maintain order or have dependencies between iterations.
When to use FOR loops
- Batch data loading: Insert multiple nodes or edges from a collection
- Data transformation: Process and update multiple records
- Graph construction: Build relationships between collections of nodes
- Nested iterations: Create connections between all pairs of elements
Quick examples
Basic iteration
Destructuring
Nested loops
Detailed guides
Basic FOR Loops
Iterate over collections with simple variable binding
FOR Loop Destructuring
Extract multiple properties directly in loop variable binding
Nested FOR Loops
Use multiple levels of iteration for complex operations