- #1
OMGCarlos
- 28
- 0
I use the ternary operation in web development all the time, eg:
x = y > z ? a : b
Which reads, if x > y then a, otherwise b
I realize that it is just a shorthand for if...else statements, but even still, are there any mathematical properties associated with it? I know inequalities have special properties - for example, dividing both sides by a negative.
I recently picked up an elementary book on set theory and I keep thinking about this. It would be interesting to know that in certain cases, I can just skip the operation and automatically assign x to a-something
x = y > z ? a : b
Which reads, if x > y then a, otherwise b
I realize that it is just a shorthand for if...else statements, but even still, are there any mathematical properties associated with it? I know inequalities have special properties - for example, dividing both sides by a negative.
I recently picked up an elementary book on set theory and I keep thinking about this. It would be interesting to know that in certain cases, I can just skip the operation and automatically assign x to a-something