# If

Run code only when a condition is true, with if, if-else and else if, and write conditions with C#'s comparison operators.

![Cheat sheet: If](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/21bb193d450349bb8e861b212f436ef5.webp)

- Category: C#
- Level: Novice
- Tags: Comparison Operators (c-sharp), c-sharp, else if Statement (c-sharp), If-Else Statement
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/conditional-logic-in-csharp-if-cheat-sheet
