The facility to branch is a need in any programming language, and ECMA-script has many useful solutions
Nested if-else blocks, switch blocks, etc are one method
let a = x+y==2
let b = x+y>2
let c = x+y<2
// Example #1
if(a){
} else if (a && b) {
} else if (b) {
} else /* c */ {
}
// Example #2
switch(input){
case a:
switch(input){
case b:
}
case b:
case c:
}
However, tracing the grouping of many thousands can get unwieldly, and can become intractable
I have another solution, similar to ECMA switch statements, to better manage large blocks of indented code -- branch-groups
branch-group( expression[:label] [, expressionN[:label] ]* ){
codeblock,
.
.
.
codeblockN,
}
Think of these as linear switch statements
Because most branching is performed following a comparison, branch-groups allow comparisons to be performed in parallel, allowing for a linear code retrace
And with the use of comma-delimiting, branch-groups allow for fall-through comparison, eliminating the need for nesting
branch-group[ x+y==2:000,x+y>2:001;x+y<2:002 ]{
000: myFunctionCallOrCodeBlock000(), // x+y==2
001: myFunctionCallOrCodeBlock001(), //(x+y==2) && (x+y>2)
002: myFunctionCallOrCodeBlock002() // x+y<2
}