Description\n-----------\n\nSyntax\n\n``sql\nRETURN expr\n`\n\nThe RETURN statement terminates execution of a stored function and returns the value _expr_ to the function caller. There must be at least one RETURN statement in a stored function. If the function has multiple exit points, all exit points must have a RETURN.\n\nThis statement is not used in stored procedures, triggers, or events. LEAVE can be used instead.\n\nThe following example shows that RETURN can return the result of a scalar subquery:\n\n`sql\nCREATE FUNCTION users_count() RETURNS BOOL\n   READS SQL DATA\nBEGIN\n   RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/return