Essa estrutura de if-then-elsif-end me lembrou muito VHDL hahaha, um dos meus xodós na faculdade