{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3f94fd0f",
   "metadata": {},
   "source": "```{index} loop; for for\n```\n\n(for-loops)=\n\n# Iteration\n\n<!-- chapter-intro -->\n\nRepeating a task is one of the most powerful things a program can do. This chapter covers two fundamental loop structures in C# — `for` and `while` — and the patterns that make them correct and readable.\n"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "id": "e5a27f61",
   "source": "<h2>Why this chapter matters</h2>\n\nLoops are how programs scale from toy examples to real work:\n\n- process every element in a collection without copy-pasting code\n- repeat a prompt until the user provides valid input\n- compute sums, products, and counts over arbitrary amounts of data\n- automate tasks that would be impractical to write out by hand\n"
  },
  {
   "cell_type": "markdown",
   "id": "ef67350f",
   "metadata": {},
   "source": "<h2>Learning goals</h2>\n\nBy the end of this chapter, you should be able to:\n\n- write counted loops with `for` and open-ended loops with `while`\n- traverse a string character by character\n- use `break` and `continue` purposefully\n- recognize and avoid infinite loops\n\n<h2>Chapter flow</h2>\n\n```{tableofcontents}\n```\n"
  }
 ],
 "metadata": {
  "jupytext": {
   "cell_metadata_filter": "-all",
   "main_language": "python",
   "notebook_metadata_filter": "-all"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}