language: C++
licence: Other
Ternery operator / conditional expression
// Syntax :
variable = condition ? value if true : value if false
// Using the ? operator :
int opening_time = (day == WEEKEND) ? 12 : 9;
// Without using the ? operator :
int opening_time;
if (day == WEEKEND)
opening_time = 12;
else
opening_time = 9;



library
latex (12)