Proposal: `then`, `else` syntax to replace `&&`, `||` short-circuiting

Regarding readability:

  • If we use operators such as && or ? etc., then it’s a good idea to stick to semantics that exists in other languages, so that code is easier to read.
  • If we use keywords for this, then we could also do:
length(a) == length(b) or else raise "problem!"
length(a) != length(b) and then raise "problem!"

That is, instead of using just then and else as keywords (difficult to parse), or just and and or, we can use two keywords. We could also (as we do in elseif) combine these to the keywords orelse and andthen.

1 Like