+ 1

Can we use relationlal and conditional operators within case?

28th Sep 2017, 3:24 AM
akash
2 ответов
+ 6
Unfortunately nope, switch case is used for equality comparison only but it can behave like logical OR in traditional if-else like this:- https://code.sololearn.com/c71KtCEf8yCQ/?ref=app
28th Sep 2017, 4:06 AM
Zephyr Koo
Zephyr Koo - avatar
+ 1
yes we can use. we can write a multiple lines block in a case. e.g switch (x) case 1 : {} case 2 :{} default :{} in block {} there can be operators.
28th Sep 2017, 3:27 AM
Azam
Azam - avatar