Type Mismatch

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Error message

Occurs when you try to pass a parameter of an incorrect data type to a method or function or use an incorrect data type in an assignment statement. The second line of the error message tells you the data type that expected and the data type that was received.


Examples

Trying to assign a string to an Integer variable:

Var n as Integer
n="Anthony"


The second line of the error message says, "Expected Int32 but got String."

Trying to assign a value to an array instead of an element of the array.

Var truth(3) as Boolean
truth=True  //must have a subscript


The second line of the error message says, "Expected Boolean() but got Boolean."