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
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
7 ай бұрын
Thanks bro
@PersonCoding
Ай бұрын
Hi bro
If (you enjoyed this vid) { like } else { like anyway }
Being trying to get through this problem since ages. watched at least 20 vids
OMG thank you sooooo much. I’ve been trying to make a chat bot and this is just what I need!
Very helpful! Thank you sir
Excellent, thanks!
You just helped me with my assignment,, thank u :)
Very helpful, thanks
Thanks for the video Bro.
Oooh, thank you for this!
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.
Thanks!
Bro, great video.
Thank you, bro code!
Legend
best online class ever!
Thanks ❤
noice
lesson check😇
" "You haven't been born yet" " 💀
@movieworld812
Ай бұрын
" "You are to old to sign up" " ☠️
that's bro
Can we use if statement for string variable?
@Ayeky_koko
2 ай бұрын
Yes if we use string Variable in first we can use it
@zanvee
Ай бұрын
@@Ayeky_koko thanks for replying man i been waiting 2 years for my answers
would give it a like, but it's at 69
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
Жыл бұрын
well technically you can't, since it's an "int" prefix and not "string"
@RandomGuyOnDaFreakingNet
8 ай бұрын
this guy also made a tutorial for C# exception statements, go watch that
1:31 i am 12 years