If & Switch Statements (Exercise) – Learn C#


This is an exercise for this YouTube video.

Happy learning and good luck!

You want to compare two variables and based on the result of the comparison, you want to do something.

What statement(s) can you use?


Assignment: Write code which will determine the sign of  a number.



Click to see the answer





Assignment: Make a simple chatbot using switch statement.



Click to see the answer





About the author 

Matt Rešetár

Matt is an app developer with a knack for teaching others. Working as a Flutter freelancer and most importantly developer educator, he doesn't have a lot of free time 😅 Yet he still manages to squeeze in tough workouts 💪

You may also like

Flutter Bloc & Cubit Tutorial

Flutter Custom & Staggered Page Transition Animation Tutorial

  • Hi am a fan of your work.I’ll probably be visiting this website like everyday.
    Please could you make a tutorial about arrays.
    And I will also recommend putting a few ads to help your business.

    • Hello! I’m happy that you enjoy my videos!
      Tutorial about arrays is coming up next in the Learn C# course.
      Thanks for the recommendation, but I’m not planning to use this website as a income stream (at least not yet), so I think the “huge” amounts of YouTube money I get is enough 😀

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}