I used to write this
if (condition)
{
str = "A";
}
else
{
str = "B";
}
finalstr = "Hello "+str;
I wonder if there is a better way.
What I want is
finalstr = "Hello "+ if (condition) {str = "A"} else {str = "B"};
or
finalstr = "Hello "+ condition ? "A" : "B";
Something like $var = "Hello ".if(condition)...
in php.
Is there a similar way to put a condition right into a string?