Great job! You just learned about how to create programs that use control flow. Here’s a few of the things we covered:
else if, and
elsekeywords to write conditional statements
- Writing switch statements for situations where they are many conditions
- Using ternary operators for shorter conditional statements
Now that you know a few things about control flow, try writing a program that:
- Has a user guess a random number between 1-10 and lets them know if they got it correct, are too low, or are too high
- Asks users to select their favorite fast food and tells them what type of cat they are (or basically, any kind of Buzzfeed style quiz)
- Checks if it’s your birthday. If it is, it will print out a celebratory ASCII banner and if not, it will tell you how many days until your birthday.
Time for some practice! Use the code editor to play around with what you learned in this lesson. If you’re not sure what to do, try one of the extensions above! This is a regular console, so make sure to press Run to save your code, then type
dotnet run in the console to see it in action.
Take this course for free