Ternary in if condition | SoloLearn: Learn to code for FREE!

+1

Ternary in if condition

Is it possible to use ternary operator inside if conditions??

8/26/2018 4:55:13 AM

Sri Sudhan

5 Answers

New Answer

+10

Yes.

+8

Is there a specific code snippet leading you to believe that you cannot?

+4

No I just came with the situtation where i needed ternary inside if.

0

0

No, it’s like c-condition if((c1 && c2) ? true : c3)