Home AMX User Forum NetLinx Studio

Function Return Value

I copy and paste the example from the help file and still get an error...

DEFINE_FUNCTION INTEGER myFunction (INTEGER Var0)
{
INTEGER nBytes
STACK_VAR RESULT
nBytes = 0
RETURN = Var0 + nBytes
RETURN RESULT
}


ERROR: program.axs(66): C10227: RETURN without a <value> allowed only inside a subroutine

Why!?

Comments

  • BigsquatchBigsquatch Posts: 216
    Corrected:
    DEFINE_FUNCTION INTEGER myFunction (INTEGER Var0)
    {
    INTEGER nBytes
    STACK_VAR RESULT
    nBytes = 0
    [b]RESULT[/b] = Var0 + nBytes     // Assign to RESULT not to RETURN. RETURN is not a variable
    RETURN RESULT
    }
    
Sign In or Register to comment.