elsif
Elsih is a conditional control flow construct used in some programming languages to chain multiple conditions after an initial if. It stands for “else if” and is typically implemented as a distinct keyword or reserved word. When an if condition evaluates to true, the corresponding block executes and the rest of the chain is skipped. If false, the interpreter evaluates the next elsif condition, and if that is true, its block executes, and so on. If none of the conditions are true, an optional else block runs.
Languages: Ruby uses elsif as the keyword to introduce the next condition in the sequence. In Ruby,
Usage considerations: elsif is used to test multiple mutually exclusive conditions in a clear, linear order.
See also: if statement, else, case expression, elif, elseif.