Learn to Code via Tutorials on Repl.it!

← Back to all posts
Part 3 c# tutorial: Revenge of the if
Bunnytoes

Hello and it's time to learn about if and switch statements, an if statement checks if you get what you want

I will use an else if which is basically another if and else to know what you do

Enter 2 3 or anything else and my code will know what you picked else statements are used if none is true

So what did you think of that? well time for switch statements enter 2, 3 or another number default statements are used if none are true

Make sure to use a : after your condition and a break for the next case
ifs are very important, they most times for better than switch but at times switch is better

alright that is almost all you need to know about ifs, but make sure to put your if code into the curly brackets and put code outside it so after the if statement it keeps going normally

Voters
Bunnytoes