Can I extend conditional expression in C++

Can I make conditional expression with more than one else if:

Casual condition:

int number = 50;
if (number > 23) cout << "The variable number is greater then 23 " << endl;
else cout << "23 is greater then variable number"  << endl;

Conditional expression:

 int number = 50;
 cout << (number > 23 ? "The variable number is greater then 23 " : "23 is greater then variable number")<< endl;
 

Is it possible to add more "else if" in this second case or it's only possible to add one condition consisting from "if and else"



Read more here: https://stackoverflow.com/questions/64412650/can-i-extend-conditional-expression-in-c

Content Attribution

This content was originally published by RObertos12 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: