{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "54c168de",
   "metadata": {},
   "source": "```{index} statement; if if\n```\n\n(if-statements)=\n\n# Conditionals\n\nPrograms become useful when they can make decisions. This chapter introduces the C# constructs that choose different code paths: `if`, `else if`, `else`, `switch`, and the Boolean expressions that control them.\n\n- **Boolean expressions**: Conditions evaluate to `true` or `false` and drive program decisions.\n- **`if` statements**: An `if` statement runs code only when its condition is true.\n- **Multi-branch logic**: `else if`, `else`, and `switch` handle several possible cases.\n- **Logical operators**: Operators such as `&&`, `||`, and `!` combine or reverse conditions.\n\nConditionals let programs validate input, express business rules, and respond differently as data changes.\n"
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": "<h2>Video</h2>\n\n```{eval-rst}\n.. youtube:: pSPQnXleaS8\n   :width: 560\n   :height: 315\n```\n\n> *[C# if statements 🤔](https://youtube.com/watch?v=pSPQnXleaS8)* by Bro Code.\n>\n> This video remains hosted on YouTube and is the property of its original creator or rightsholder; it is embedded here via YouTube's official player for educational reference only.\n",
   "id": "intro-video"
  },
  {
   "cell_type": "markdown",
   "id": "learning-objectives",
   "metadata": {},
   "source": "<h2>Learning Objectives</h2>\n\nBy the end of this chapter, you will be able to:\n1. Write `if`, `else if`, and `else` chains correctly\n2. Construct Boolean expressions with comparison and logical operators\n3. Handle multiple exclusive cases with a `switch` statement\n4. Trace which branch of a conditional statement will execute\n5. Avoid common conditional mistakes such as dangling `else` and boundary errors\n"
  },
  {
   "cell_type": "markdown",
   "id": "chapter-flow",
   "metadata": {},
   "source": "<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
}
