👨💼 Excellent work! You now have multiple tools for iteration!
You've learned:
- 🔄 for loops - Precise control over iteration count
- ⏱️ while loops - Continue until a condition changes
- 📦 for...of - Clean syntax for iterating arrays
When to use each:
| Loop Type | Best For |
|---|---|
for | When you need the index or specific iteration count |
while | When you don't know how many iterations ahead of time |
for...of | When you just need each value from an array |
forEach/map/filter | When transforming or filtering arrays |
📝 Remember: with great looping power comes great responsibility. Always ensure
your loops will eventually end - infinite loops crash programs!
Test Your Knowledge
Retrieval practice helps solidify learning by actively recalling information. Use this prompt with your AI assistant to quiz yourself on what you've learned.
Please quiz me on exercise 7 using the epicshop MCP server. Call the get_quiz_instructions tool with exerciseNumber "7" to get the quiz instructions, then quiz me one question at a time.