KevinScript icon indicating copy to clipboard operation
KevinScript copied to clipboard

Ternary expression

Open kms70847 opened this issue 4 years ago • 0 comments

One of KS' goals is to make it possible to do anything with a single very large expression. So it would be nice to have a ternary expression so you don't have to use if statements.

Unclear what the syntax should be. Candidates:

  • a if b else c
  • b ? a : c
  • if(b){a}else{c}

If the final candidate is adopted, we need to decide how to handle inline if expressions that don't have an else block, and if expressions whose bodies contain more than one statement.

kms70847 avatar Apr 20 '20 15:04 kms70847