Differences
This shows you the differences between two versions of the page.
| |
| programming [2025/10/03 11:39] – created carl | programming [2025/10/03 11:54] (current) – carl |
|---|
| ====== General Programming ====== | ====== General Programming ====== |
| |
| | |
| | |
| | === Ternary Operators === |
| |
| Are there any non-conditional ternary operators? As asked [[https://stackoverflow.com/questions/37281698/are-there-ternary-operators-that-arent-some-form-of-a-conditional-operator|here]], The answer there suggests that no, there are no ternary operators, and you might as well call a function. | Are there any non-conditional ternary operators? As asked [[https://stackoverflow.com/questions/37281698/are-there-ternary-operators-that-arent-some-form-of-a-conditional-operator|here]], The answer there suggests that no, there are no ternary operators, and you might as well call a function. |
| |
| However, upon thinking more, unary and binary operators make sense because they naturally split a linear progression of text. A binary operator conjoins the "left" and "right" text. A ternary operator doesn't exactly fit into this model. However, a quartary (4 way) operator would make sense if code was 2 dimensional. The arguments to the operator above and below, not just left and right, would be included. | However, upon thinking more, unary and binary operators make sense because they naturally split a linear progression of text. A binary operator conjoins the "left" and "right" text. A ternary operator doesn't exactly fit into this model. However, a quartary (4 way) operator would make sense if code was 2 dimensional. The arguments to the operator above and below, not just left and right, would be included. |