Interface return values

My interface method uses a boolean return value.
My class method using that interface does NOT return a value.
Xojo does not give an error not a warning, it just returns false !!!

Is that the normal way with interfaces not to get a warning or error if the return value is not used ?

It’s normal. Xojo returns the default value for whatever type your method returns. For Boolean, that’s False.

Note that if you explicitly use the Return statement, you will get a compile error, but if you just let the method end without a Return, you get the default.

thanks Tim

a warning would be nice

How do you mean that? I probably misunderstand what you are saying but this example returns True just fine … no compile error.

I mean if you return a value that doesn’t match the method signature, the compiler will complain. But if you don’t return anything, the compiler will supply the default value for the method signature. Eg.,

Function KeyDown(Key as String) as Boolean
   Return "OK"
End Function

And

Function KeyDown(Key as String) as Boolean
   Return
End Function

will both get compile errors. Whereas

Function KeyDown(Key as String) as Boolean
   Return True
End Function

and

Function KeyDown(Key as String) as Boolean
   // no return statement
End Function

will compile just fine. In the second instance, you get the default value of False.

Naturally.

But you CAN explicitly use the Return statement to return True in his case.

Pity you can no longer fix that answer. Maybe an admin could clarify what you meant.