C# if statements 🤔

Ғылым және технология

C# if else if else statements tutorial example explained
#C# #if #statement
using System;
namespace MyFirstProgram
{
class Program
{
static void Main(string[] args)
{
//if statement = a basic form of decision making
Console.WriteLine("Please enter your name: ");
String name = Console.ReadLine();
if (name == "")
{
Console.WriteLine("You did not enter your name!");
}
else
{
Console.WriteLine("Hello " + name);
}
Console.ReadKey();
}
}
}

Пікірлер: 32

  • @BroCodez
    @BroCodez3 жыл бұрын

    using System; namespace MyFirstProgram { class Program { static void Main(string[] args) { //if statement = a basic form of decision making // -------------------- Example 1 -------------------- Console.WriteLine("Please enter your age: "); int age = Convert.ToInt32(Console.ReadLine()); if (age >= 18) { Console.WriteLine("You are now signed up!"); } else if (age { Console.WriteLine("You haven't been born yet!"); } else { Console.WriteLine("You must be 18+ to sign up!"); } // -------------------- Example 2 -------------------- Console.WriteLine("Please enter your name: "); String name = Console.ReadLine(); if (name == "") { Console.WriteLine("You did not enter your name!"); } else { Console.WriteLine("Hello " + name); } Console.ReadKey(); } } }

  • @kusion7474

    @kusion7474

    7 ай бұрын

    Thanks bro

  • @PersonCoding

    @PersonCoding

    Ай бұрын

    Hi bro

  • @FukSN
    @FukSN Жыл бұрын

    If (you enjoyed this vid) { like } else { like anyway }

  • @jd_me1330
    @jd_me13302 жыл бұрын

    Being trying to get through this problem since ages. watched at least 20 vids

  • @y-it4207
    @y-it42072 жыл бұрын

    OMG thank you sooooo much. I’ve been trying to make a chat bot and this is just what I need!

  • @kultaseppa
    @kultaseppa Жыл бұрын

    Very helpful! Thank you sir

  • @leandrosantorsola684
    @leandrosantorsola684 Жыл бұрын

    Excellent, thanks!

  • @damirusensith5611
    @damirusensith56112 жыл бұрын

    You just helped me with my assignment,, thank u :)

  • @alexiscoe1040
    @alexiscoe10403 жыл бұрын

    Very helpful, thanks

  • @spartanranger
    @spartanranger2 жыл бұрын

    Thanks for the video Bro.

  • @quexpRPG
    @quexpRPGАй бұрын

    Oooh, thank you for this!

  • @unwind8858
    @unwind88582 жыл бұрын

    Can you If else multiple choices question? Like only letter A,B,C will be accepted and then count how many times you choose each Letter to get the result of the test.

  • 3 жыл бұрын

    Thanks!

  • @zapoyou2
    @zapoyou2 Жыл бұрын

    Bro, great video.

  • @honeypunch1230
    @honeypunch12302 жыл бұрын

    Thank you, bro code!

  • @user-ig2kn8em3p
    @user-ig2kn8em3p3 ай бұрын

    Legend

  • @engirckt5410
    @engirckt54103 жыл бұрын

    best online class ever!

  • @Ayeky_koko
    @Ayeky_koko2 ай бұрын

    Thanks ❤

  • @budderrar5751
    @budderrar5751 Жыл бұрын

    noice

  • @whitedinamo
    @whitedinamo2 жыл бұрын

    lesson check😇

  • @movieworld812
    @movieworld812Ай бұрын

    " "You haven't been born yet" " 💀

  • @movieworld812

    @movieworld812

    Ай бұрын

    " "You are to old to sign up" " ☠️

  • @Zomatsu143
    @Zomatsu1434 ай бұрын

    that's bro

  • @zanvee
    @zanvee2 жыл бұрын

    Can we use if statement for string variable?

  • @Ayeky_koko

    @Ayeky_koko

    2 ай бұрын

    Yes if we use string Variable in first we can use it

  • @zanvee

    @zanvee

    Ай бұрын

    @@Ayeky_koko thanks for replying man i been waiting 2 years for my answers

  • @zakmartin7567
    @zakmartin75672 жыл бұрын

    would give it a like, but it's at 69

  • @saferji8538
    @saferji8538 Жыл бұрын

    bro what if i entered a letter in age what code do i have to enter to restrict the letter from age hope u see this thanks

  • @S3th_art

    @S3th_art

    Жыл бұрын

    well technically you can't, since it's an "int" prefix and not "string"

  • @RandomGuyOnDaFreakingNet

    @RandomGuyOnDaFreakingNet

    8 ай бұрын

    this guy also made a tutorial for C# exception statements, go watch that

  • @__random_variable
    @__random_variable2 жыл бұрын

    1:31 i am 12 years