I’ve just seen this line of code in my housemates code.
Bool bool = method() > 0;
or
string name = "Tony";
boolean nameIsTony = name == "Tony";
This would result in nameIsTony becoming true.
So you can have an inline conditional statement?
What is this called?
name == "Tony"(or rathername.equals("Tony")as it should be) is a Boolean expression, so I’m guessing a Boolean expression is the closest term to what you are looking for.It’s an expression rather than a statement – it evaluates to something, rather than doing something. And it’s not really conditional, as it always evaluates to a Boolean value – there’s nothing conditional in its behaviour, just its result. So I’d go for “Boolean expression”. The “inline” isn’t really necessary.