[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Error 44 Type Mismatch pp 322
Source: Compiler
Cause: 1) Incompatible types of the variable and the expression in
an assignment statement.
2) Incompatible types of the actual and formal paramters in
a procedure or function call.
3) Expression type incompatible with index type in an
array assignment.
4) Incompatible assignment between file types.
5) Incompatible types of operand expressions.
Remedy: Examine the statement ahead of the error cursor for the above
conditions.
Example (1):
VAR
IntVar : Integer ; { Declare type Integer }
RealVar : Real ; { Declare type Real }
BEGIN
IntVar := RealVar ; { Illegal assignment }
END.
Example (2):
PROCEDURE One (A:Integer) ; { Integer procedure paramter }
Begin
End;
BEGIN
One (2.0) ; { Illegal paramter type }
END.
Example (3):
VAR
ByteArray : Array [0..9] of Byte ; { Array is type Byte }
RealVar : Real ; { Declare a type Real }
BEGIN
RealVar := 4 ; { Assign integer value }
WriteLn (IntArray[RealVar]) ; { Invalid subscript type }
END.
Example (4):
TYPE
FileType = Record
Name : String [80] ; { 80 byte type String }
Age : Byte ; { Type Byte }
End ; { Of Record }
VAR
IntVar : Integer ; { IntVar is type Integer }
FileVar : FileType ; { File of FileType }
BEGIN
Write (FileVar,IntVar) ; { IntVar is not type FileType }
END.
Example (5):
VAR
RealVar : Real ; { Declare a type Real }
BEGIN
RealVar := 'Testing' ; { Assign string value to Real }
END.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson