5 ms·
Sample syntax: y = ( i>=1 .And. i<=Size(a) ? a(i) : -Huge(y) ) The proposal has been approved, but the final standard will be voted on, and it will take t
by Bostonian 5y ago
Sample syntax:
y = ( i>=1 .And. i<=Size(a) ? a(i) : -Huge(y) )
The proposal has been approved, but the final standard will be voted on, and it will take time for it to appear in compilers.
- xxpor 5y agoSorry, not familiar with Fortran at all. Did ternaries already exist, and this just adds assignment or is the ternary new too?
- deleted 5y ago[deleted]
- Bostonian 5y agoThe ternary is new. Before, one could use the merge intrinsic function to write y = merge(a(i), -Huge(y), i>=1 .And. i<=Size(a)) but this is risky, because merge does not short-circuit, and the program could crash if i < 1. The ternary syntax y = (boolean ? expression_1 : expression_2) only evaluates one of the expressions.