is there a programming language that doesn’t support else if at all

not even as the sneaky “second if is inside else

comments (single view)

I'd say that, as long as a programming language supports IF, AND and NOT, then there should be a workaround for ELIF in there somewhere. For example,

IF (BOOL-A) {
  FUNCTION(A)
} ELIF (BOOL-B) {
  FUNCTION(B)
} ELSE {
  FUNCTION(C)
}

could be worked around like this:

IF (BOOL-A) {
  FUNCTION(A)
}
IF (!BOOL-A && BOOL-B) {
  FUNCTION(B)
]
IF (!BOOL-A && !BOOL-B) {
  FUNCTION(C)
}
View all comments