Knowledge Base

"Type Mismatch" Passing Numeric Constants in CALL Statement

Article ID: 20539

Article Last Modified on 11/21/2006


APPLIES TO


This article was previously published under Q20539

SUMMARY

When you pass numeric constants as arguments in a CALL statement to invoke a subprogram, they must agree in type (integer%, single-precision!, or double-precision#) with the formal parameters in the subprogram SUB statement, or else you will get a "Type Mismatch" error.

This information applies to Microsoft QuickBASIC Versions 1.00, 1.00a, 1.00b, BASIC compiler Version 1.00, and BASIC interpreter Versions 2.00, 2.10, and 3.00 for the Apple Macintosh.

MORE INFORMATION

An example of making CALL arguments and SUB formal parameters agree is as follows:
' It is best to explicitly type numeric constants with %, !, and #
' to be sure that they are passed with the correct type:
CALL Test (2%, 4.5!, 8.5436#)
STOP
' Formal parameters X%, Y!, Z# must agree in type with CALL arguments:
SUB Test(X%, Y!, Z#) STATIC
PRINT X%, Y!, Z#
END SUB
				
Note the arguments passed to DEF FN functions do not have to agree in type with the formal parameters used in the DEF FN statement.

Additional query words: BasicCom MQuickB

Keywords: KB20539