In C #, you can use the built-in if condition without a value, in other words, return void?
public void FuncReturningVoid ()
{
return;
}
public void AnotherFuncReturningVoid()
{
return;
}
public void Test ()
{
int a = 1;
int b = 2;
a == b ? FuncReturningVoid() : AnotherFuncReturningVoid();
if (a == b)
{
FuncReturningVoid();
}
else
{
AnotherFuncReturningVoid();
}
}
source
share