Is it possible to execute if and else blocks both at a time?
Is it possible to execute if and else blocks both at a time?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pankaj Kumar ChoudharyPosted May 14, 2015, 12:32 PM
both can not at same time but if you want to execute both segment of if and else then you can use GOTO method like this:
int ab = 100;
pan:
{
if (ab == 100)
{
Console.WriteLine("In If Block");
ab = 101;
goto pan;
}
else
{
Console.WriteLine("In Else Block");
}
}
Console.ReadLine();
Output will be:
In if Block
In Else Block
Vincent Maverick DuranoPosted May 14, 2015, 8:33 AM