+ 3
if else in C#
how to check the array is empty in C# using if else statement. That is, if array is empty, I want to print that "The array is empty". Please help me.
2 Answers
+ 5
Assuming array is called arr:
if(arr.Length == 0)
{
Console.WriteLine("The array is empty");
}
0
int x= 1;
if(x==1){
Console.WriteLine("Yes");
}else{
Console.WriteLine("No");
}