Conditionals
Conditional (Ternary) Operator
Syntax
condition ? value_if_true : value_if_false
How it's Used
void PrintCowName(std::string name) {
std::cout << "Cow's name is: " << name << std::endl;
}
bool is_a_cow = true;
PrintCowName(is_a_cow ? "tom" : "not_a_cow");
Other
Last updated