3 ms·
the conditional syntax he describes does exist in many mainstream programming languages (x==y) ? a : b
by probablyrobots 15y ago
the conditional syntax he describes does exist in many mainstream programming languages
(x==y) ? a : b
- peti 15y agoMoreover, using an arrow operator, the OP almost wrote a Prolog expression: ( X==Y -> A ; B)
- masklinn 15y agoNo. You can't put statements in this, only expressions. It's a limited special case instead of a generic tool (and putting a sequence of conditionals and actions is not going to look good, though I'm sure you can coerce them into it using the "," operator, as long as you don't need to have an iteration as well). There are languages which have pretty much exactly what he describes (Smalltalk for instance), but "many mainstream languages" don't.