0
If-else statements
Can someone show me a really simple example using if-else (with numbers for example)?
3 Respuestas
+ 2
I have added string compare in my example. Spaces are ignored in c# so use as many as you like
+ 1
int x = 3;
if (x == 3)
{
Console.WriteLine("x is three");
}
else
{
Console.WriteLine("x is not equal to three");
}
https://code.sololearn.com/cUpZ3Z79jL0S
What is it you do not understand about if else statements ?
+ 1
Thanks, I tried some codes with numbers and it worked, but, when I did the same but with string type, only problem was with part after "if"( where you have (x==3)). Can you please give me an example where x==3 is replaced with some word?