Multi Condition in the Case | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Multi Condition in the Case

Can one, in a case several conditions of the contract? What shape?

24th Aug 2016, 12:21 PM
Mahdi Behfar Baghovvat
Mahdi Behfar Baghovvat - avatar
2 Answers
+ 1
If you mean having two cases in one switch block end up doing the same, you'd either want to use an if block instead or do something like int x = 4; switch(x) { case 4: goto case 2; case 2: Console.WriteLine("x is 4 or 2"); break; } though remember, in switch blocks you can always only check the state of one object. If you want to check 2 different objects you will need to use an if block.
25th Aug 2016, 3:15 PM
LetSPlaYRagE23
LetSPlaYRagE23 - avatar
0
No. I mean put some criteria in a case. If it's possible to form should be written ... Thanks for your tips.
25th Aug 2016, 6:54 PM
Mahdi Behfar Baghovvat
Mahdi Behfar Baghovvat - avatar