How DEFINT, DEFSNG, DEFDBL Affect Type of DEF FN Function (21311)






This article was previously published under Q21311

SUMMARY

This article discusses the default type declaration of DEF FN user-defined functions in Microsoft Basic.

The DEFINT, DEFLNG, DEFDBL, and DEFSNG statements affect the first letter of the variable part of a DEF FN function name, and not the FN part of the function name. This information applies to all Microsoft Basic compilers and interpreters for MS-DOS, MS OS/2, Macintosh, and CP/M-80.

Microsoft Basic Compiler versions 6.00 and later, and QuickBasic versions 4.00 and later for the IBM PC, introduced the DEFLNG statement for long integer declaration, which also behaves this way.

MORE INFORMATION

Example

The following program prints 1.2 (a noninteger):
   10 DEFINT F   ' DEFINT F doesn't affect the DEF FN below.
   20 DEF FNAB=1.2
   30 PRINT FNAB
				
The following program prints 1 (truncated to an integer):
   10 DEFINT A   ' DEFINT A does affect the DEF FN below.
   20 DEF FNAB=1.2
   30 PRINT FNAB
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB21311