C# Tutorial 3 Conditionals While Exceptions

48
3



Get the Code Here :
Best C# Book :
Support me on Patreon :

In this part of my C# tutorial we’ll cover If, Else, Else If, Relational Operators, Logical Operators, Ternary Operator, Switch, Break, Continue, Goto, While Do While, Convert, Try, Catch, Finally and Exception Handling.

For best results take notes on the cheat sheet provided above as you watch and leave any questions you have.

Thank you to Patreon supporters like the following for helping me make this video

facebook.com/cottageindustriesbuild/
jaryd remillard : instagram: @distant_admiration
bugreplay.com
@kyleaisho
@thetwistedhat
vjFaLk
jaryd remillard :

Nguồn:https://wijstaanvooronzegrondrechten.org/

48 COMMENTS

  1. First video from you aaaaannnnd I immediately searched about you on udemy. I hope you will a release a c# course there. You know why? Because you are a unique teacher who diserves a lot. Thanks

  2. Great tutorial, thanks Derek.
    Range switch statement is now available in C# using when keyword.
    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/switch

    sample:
    int num = 129;

    switch (num)

    {

    case int n when (n < 50):

    Console.WriteLine($"{n} is less than 50");

    break;

    case int n when (n <= 100 && n >= 50):

    Console.WriteLine($"{n} is beetween 50 and 100: {n}");

    break;

    case int n when (n > 100):

    Console.WriteLine($"{n} is greather than 100");

    break;

    }

  3. For people that wan't a REAL random you should follow what i'm gonna say:

    Just do -> Random random = new Random(Guid.NewGuid().GetHashCode());

  4. Great Tutorial!! Love the way you teach!
    Derek, when you try to divide by zero, if you dont "throw" the exception, the system won't throw it automatically for you?
    Thanks!

  5. Hi Everyone,

    Thank you Derek for this fabulous C# source. I would like to learn how to work with form application like creating a calculator. I am not sure which of your videos is appropriate to address it. Could anyone let me know which tutorial part should I watch?

    Thank you again.

  6. I don't know if someone notice that, but:
    else if ((age > 7) && (age < 13))
    else if ((age > 13) && (age < 19))
    So, if my student have '13' || >=19 age, then he go to college. 😀

  7. Question: While Loops

    Can I create a while loop that is just:

    While(true)
    {
    //do stuff
    if(exit is typed)
    WhileCondition = False
    }

    Now I'm not asking if I can change a variable to false, I mean literally, put true in the while condition, and directly change the While loops condition to false?

  8. Derek, just want to ask a question in 3:30

    Console.WriteLine("! true = " + (!true));

    Output: ! true = False //because the ! symbol is put in front of the (true)

    Console.WriteLine(!false);

    Output: True

    Console.WriteLine(false);

    Output: false

    Console.WriteLine(true);

    Output: True

    Did I get it correct?

  9. if (name.Equals(name2, StringComparison.Ordinal))
    What does StringComparison.Ordinal even mean ?
    I am a little bit confused. It would be great if you help if you don't mind.
    However, thank you for your clear clarification on the syntax of C# !
    I have been relishing your tutorials a lot !

  10. Since C#7 it is possible to have ranges in switch statements like:

    switch (i)
    {
    case int n when (n >= 100):
    Console.WriteLine($"I am 100 or above: {n}");
    break;
    }

  11. Hi Derek, the way you teach is straightforward and awesome even for experienced developers like me. I subscribed you and started to review all my knowledge by help of your fantastic videos. Thanks a lot and best wishes for you.

  12. Hi, I just have a simple question, is there a reason that you would use:

    if (name.Equals(name2, StringComparison.Ordinal))

    instead of:

    if (name == name2)

    Thanks.

  13. so for the random number command if I want to generate numbers 1 through 3 do I use
      Random p1 = new Random();
                    int c1 = p1.Next(1, 3);

  14. Thanks a lot for this series. I'm doing it under Linux with Visual Studio Code, compiling with "dotnet run". Works well 🙂 I heard a lot of good things of this language, so finally I decided to try it. Your videos help a lot.

  15. when i make random no game
    the code is here

    Random rand = new Random();
    int SecretNum = rand.Next(1, 11);
    int GuessedNum = 0;
    do
    {
    Console.WriteLine(SecretNum);
    Console.Write("enter number between 1 & 10 : ");
    GuessedNum = Convert.ToInt32(Console.ReadLine());
    } while (SecretNum != GuessedNum);

    the message popped that
    format exception was unhandledAn unhandled
    exception of type 'System.FormatException' occurred in mscorlib.dll
    Additional information: Input string was not in a correct format.

  16. currently im studying this language in school. We had to choose between Java and c# and because there aren't any new projects being built in java i chose c#. But my school has a special way of teaching us how to use code. For example with python, last period, we had to draw some ASCII art. Something like a piramide using math and printing it with *'s. I was just wondering what your opinion is on this method of teaching code.
    Also, i love your voice it's so peaceful and fun to listen to 😀

  17. Thank you man. That was awsome.
    Just if you dont mind to explain for me the utility of CultureInfo of System.Globalization
    cause AppendFormat seems working without it.

  18. quick and smooth, as always. from Derek! even if I know these stuff, it is always awesome to hear from you too!
    please cover some advanced topics of C# as well! 🙂

LEAVE A REPLY

Please enter your comment!
Please enter your name here