Can not execute custom function correctly

So am trying to call this function:

CREATE FUNCTION [dbo].[SeqChar] (@IN VARCHAR(1))
RETURNS VARCHAR(3)
AS

BEGIN
Declare @wINC VARCHAR(3)=@IN;

IF @IN = 'T' 
   SET @WINC = 'TXT'
ELSE
IF @IN = 'U' 
   SET @WINC = 'USR'
ELSE
IF @IN = 'V' 
   SET @WINC = 'VOT';
RETURN @WINC

END
'====================
So when I attempt to test using this:
Declare @wTst varchar(1)='T';
Declare @wT varchar(1);
set @Wt=SeqChar(@wTst)
RETURN @wTst
'============
receive an error A RETURN statement with a return value cannot be used in this context.

What am I doing wrong??

The function itself is fine. Check the code around it, it must be a parsing error. In particular, if there's other code, be sure you have a "GO" just before the CREATE FUNCTION statement, since functions must be in their own batch.

Hmm
No matter what I do... I get
Use XXX (database name)
Go
Declare @Wxst nvarchar(1)=seqchar('T')
Return @Wxst
'===== Receive the error message
RETURN statement with a return value cannot be used in this context.

First create the function, then execute it:


USE xxx
GO

CREATE FUNCTION [dbo].[SeqChar] (@IN VARCHAR(1))
RETURNS VARCHAR(3)
AS
BEGIN
Declare @wINC VARCHAR(3)=@IN;

IF @IN = 'T' 
   SET @WINC = 'TXT'
ELSE
IF @IN = 'U' 
   SET @WINC = 'USR'
ELSE
IF @IN = 'V' 
   SET @WINC = 'VOT';
RETURN @WINC
END
GO

SELECT dbo.SeqChar('T')

Ahhhh I was trying to do a "set" not a SELECT
Thank you VERY much.

Appreciate it!!