Seems pixilang has no way to do "else if", which can be useful when we need to a lot of range check.
I understand we can use if and else only:
Code: Select all
if a >= 0 && a < 10 {
function a
} else {
if a >= 10 && a < 20 {
function b
} else {
if a >= 20 && a < 30 {
function c
} else {
if a >= 30 && a < 40 {
function d
} else {
// and so on...
}
}
}
}
As a result, I have to write code like this to simulate the else if behavior:
Code: Select all
if a >= 0 && a < 10 {
logic a
goto END
} /*else*/ if a >= 10 && a < 20 {
logic b
goto END
} /*else*/ if a >= 20 && a < 30 {
logic c
goto END
} /*else*/ if a >= 30 && a < 40 {
logic d
goto END
}
// ... and so on
END:
Perhaps having else if, switch case, or some pattern matching for the future version of pixilang?