Contents Menu Expand Light mode Dark mode Auto light/dark mode
Learn C ๐ŸŒฑ
Learn C ๐ŸŒฑ
  • Introduction โ“
    • About Programming โ“
    • Setup ๐Ÿ› ๏ธ
  • Lesson 1 - Hello World ๐ŸŒ
    • Hello World ๐Ÿ‘‹
    • Syntax and Errors ๐Ÿ“
    • Strings ๐Ÿงต
    • Printf() ๐Ÿ–จ๏ธ
    • Escape Sequences ๐Ÿชœ
    • Project 1 - ASCII Art ๐Ÿ–Œ๏ธ
  • Lesson 2 - Variables ๐Ÿ“ฆ
    • Types ๐Ÿ”ค
    • Variables ๐Ÿ“ฆ
    • Declaration โžก๏ธ
    • Assignment โžก๏ธ
    • Intialization โžก๏ธ
    • String Variables ๐Ÿงต
    • More Printf() ๐Ÿ–จ๏ธ
    • Scanf() โŒจ๏ธ
    • Project 2 - Greeter ๐Ÿ’ฌ
  • Lesson 3 - Operators โž•
    • Operators โœ–๏ธ
    • Math Operators โœ–๏ธ
    • Expressions ๐Ÿ”ข
    • Modulo ๐Ÿ”ข
    • Integer Division โž—
    • Literals ๐Ÿชจ
    • Project 3 - Calculator ๐Ÿงฎ
  • Lesson 4 - Conditionals ๐ŸŒฟ
    • Boolean Operators โ˜‘๏ธ
    • strcmp ๐Ÿงต
    • Scope ๐Ÿ”ญ
    • If Statement ๐ŸŒฟ
    • Else Statement โ”
    • Switch Statement ๐ŸŽš๏ธ
    • Project 6 - RPS โœ‚๏ธ
  • Conclusion ๐Ÿ”š
    • Final Project - Text Adventure Game ๐ŸŽฎ
    • Next Steps ๐Ÿพ
Back to top

Lesson 4 - Conditionals ๐ŸŒฟ#

So far, our programs only did one task and one task only. But what if we wanted it to do different tasks depending on some condition?

This is why we have conditionals, which are statements that let us make branching paths for our program.

  • Boolean Operators โ˜‘๏ธ
  • strcmp ๐Ÿงต
  • Scope ๐Ÿ”ญ
  • If Statement ๐ŸŒฟ
  • Else Statement โ”
  • Switch Statement ๐ŸŽš๏ธ
  • Project 6 - RPS โœ‚๏ธ
Next
Boolean Operators โ˜‘๏ธ
Previous
Project 3 - Calculator ๐Ÿงฎ
Copyright © 2022, Atlinx
Made with Sphinx and @pradyunsg's Furo