if Statements in C#

//using if with & operators//

int y = 10;
int x = 5;
if (y<10&&x==5)
{

Console.WriteLine(true);
}
else
{Console.WriteLine(false);
}
Console.ReadLine();
celibate method The return on the code above should be false

the write line methods for both should have curry Brackets
int y = 78;
if (y <= 10)

{
                       Console.WriteLine(y);
}
else
{ Console.WriteLine("y is greater than 10");
}

Console.ReadLine();

ty.PNG

the code above is also a method for if else statements

Logical note (!)

//logical note returns the opposite false in this case//
int y = 10;
int x = 5;
if (!( y > 3 || x == 5))
{

Console.WriteLine(true);
}
else
{
Console.WriteLine(false);
}
Console.ReadLine();
Advertisements

2 thoughts on “if Statements in C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s