Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
[ FlexSim 20.1.0 ]
Hi,
It seems the type of a ternary expression a ? b : c is sometimes determined incorrectly. Consider the following four expressions:
true ? 1 : 0.5 // (1) true ? 0.5 : 1 // (2) false ? 1 : 0.5 // (3) false ? 0.5 : 1 // (4)
I'd expect (1) and (4) to be equivalent and evaluate to 1, and (2) and (3) to be equivalent with a value of 0.5.
That expectation is mostly met, except by number (3): apparently ( false ? 1 : 0.5 ) == 0. It seems the type of the result is determined by the "true" branch: false ? 1.0 : 0.5 does indeed return 0.5.
Is this a bug or just weird? 🙂
Solved! Go to Solution.