ParseError thrown

syntax error, unexpected token "endwhile", expecting "elseif" or "else" or "endif"