and if statement c# code example
Example 1: how to make if statement c#
if (/*condition here*/)
{
//code here
}
Example 2: c# if
int x;
int y;
if ( x == y)
{
Console.WriteLine("x and y is equal");
}
else
{
Console.WriteLine("x and y is not equal");
}
// Same, but shorter ( and harder XD )
Console.WriteLine($"x and y {(x == y? "is equal" : "is not equal")}");
Example 3: if statement c#
if (condition)
{
print("Yes");
}
else
{
print("No");
}