Why do I get a syntax error when everything looks fine. The error position on the MySQL workbench is indicated. I have checked alot of questions, but found no answer. I know it will be a minor problem but I can't figure it out
SELECT * FROM classicmodels.customers;
DELIMITER $$
create function CustomerLevel( credit decimal(10,2))
returns varchar(20) deterministic
begin
declare customerLevel varchar(20);
if (credit > 50000) then set customerLevel = 'PLATINUM';
else if (credit >= 50000 and credit <= 10000) then set customerLevel = 'GOLD';
else IF (credit < 10000) then set customerLevel ='SILVER';
end if;
return (customerLevel);
end; -- this is where the syntax error code is
$$ DELIMITER ;
/*
Error Code: 1064. You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near '' at line 10
*/
```````````````