Type Mismatch Error

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 REALbasic was expecting and the data type that it received.

# Examples

Trying to assign a String to an Integer variable:

Dim n as Integer
n="Anthony"

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

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

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

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