Is it possible to execute if and else blocks both at a time?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted May 14, 2015, 8:32 AM EDT
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 DuranoRank #238 · 10.3K reputationPosted May 14, 2015, 4:33 AM EDT