I graduated in 1990 in Electrical Engineering and since then I have been in university, doing research in the field of DSP. To me programming is more a tool than a job.
Ada (since 2005, I guess) has a "kind of" ternary operator that has some similarity with Ruby. In Ada you use just a "if" construct
X := (if (a > b) then 4 else 5);
If I am not wrong (I am to lazy to start the IDE and try...) you need the parenthesis around the if. I did not check thoroughly, but I think that this prevent the issues with associativity: "if" expressions have no associativity and you need parenthesis to use them. (Ada also force you to use parenthesis in expressions with both "and" and "or," in order to avoid ambiguities).
The nice part is that there is also a "case" expression
X := case day is
when Monday => 3,
When Sunday => 4,
...
end case;
They are very convenient, especially in inline functions.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As usual, the Adaist is different :-)
Ada (since 2005, I guess) has a "kind of" ternary operator that has some similarity with Ruby. In Ada you use just a "if" construct
X := (if (a > b) then 4 else 5);
If I am not wrong (I am to lazy to start the IDE and try...) you need the parenthesis around the if. I did not check thoroughly, but I think that this prevent the issues with associativity: "if" expressions have no associativity and you need parenthesis to use them. (Ada also force you to use parenthesis in expressions with both "and" and "or," in order to avoid ambiguities).
The nice part is that there is also a "case" expression
X := case day is
when Monday => 3,
When Sunday => 4,
...
end case;
They are very convenient, especially in inline functions.