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 < 0) { 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(); } } }
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.
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 < 0)
{
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();
}
}
}
Thanks bro
Hi bro
bro really doesnt know how many test he's saved me from failing :)
Being trying to get through this problem since ages. watched at least 20 vids
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.
Very helpful! Thank you sir
You just helped me with my assignment,,
thank u :)
OMG thank you sooooo much. I’ve been trying to make a chat bot and this is just what I need!
Excellent, thanks!
best online class ever!
Very helpful, thanks
Thanks for the video Bro.
Oooh, thank you for this!
Thanks bro
Bro, great video.
Thanks ❤
Legend
" "You haven't been born yet" " 💀
" "You are to old to sign up" " ☠️
Thanks!
Thank you, bro code!
noice
lesson check😇
Y O U A R E A M A Z I N G !!!!
Can we use if statement for string variable?
Yes if we use string Variable in first we can use it
@@ykta_art thanks for replying man i been waiting 2 years for my answers
comment for algorithm!
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
well technically you can't, since it's an "int" prefix and not "string"
this guy also made a tutorial for C# exception statements, go watch that
Gg
1:31 i am 12 years
that's bro
would give it a like, but it's at 69
what if
Pp