We can count numbers, now it's good to know how to write conditions.
IF means that operation is perfoming under some condition e.g. number a is 5.
ELSE means other operation under some condition, this command may be missed or you can write it how many you want.
Conditions write after if or else and into ( ). Operation write into { } and remember that ; you must write into { ;} !
Example:
int a;
a=int.parse(Console.ReadLine());
if (a>10)
{Console.WriteLine("Your number is higher than 10");}
else (a<10)
{Console.WriteLine("Your number is lower than 10");}
Console.ReadKey();
No comments:
Post a Comment