For a long time I thought that the ternary operator always returns an rvalue. But to my surprise it doesn't. In the following code I don't see the difference between the return value of foo and the return value of the ternary operator.
How do I achieve setting the value inside if else in one line?You could simply do :
could someone explain me why c and c1 are constructed different way. I understand that I have reference to copy created by '?' operator, which is destroyed after construction, but why in first case it behave other way. I've tested if its optimization, but even with conditions read from console,...
While executing following code, I am getting NullPointerException at lineIn earlier lines when I use null instead of getDouble() everything works and this is strange.
I get the following:whereas I also get:Why is true or true and false both true and false (like Schrödinger's cat)?
F#'s Condtional Expressions require a condition to check, a branch for true, and a branch for false. For example: