AlgoML
FR

Error messages

The most common messages from the checker, what they mean and how to fix them.

The checker runs before generation. When it finds an error, no code is generated: fix the line it points to and try again.

Types

MessageMeaning and fix
Cannot assign REAL to a target of type INT.You store a decimal value in an integer variable. Use div instead of /, or declare the variable as REAL.
Result of this compound assignment is REAL and cannot be stored in INT (use 'div' for integer division).x /<- 2 on an INT. Write x <- x div 2.
Cannot compare STRING with INT.Both sides of a comparison must have compatible types.
Operand of NOT must be BOOLEAN, found INT.NOT only works on a condition. Write n = 0 instead of NOT n.
Array index must be INT, found REAL.An index is always a whole number.
Array indexes start at 1: index 0 does not exist.The cells are numbered from 1. Use tab[1] for the first one.
Index 7 is out of bounds: this array has 6 elements, numbered 1 to 6.The index is larger than the size of the array.

Conditions and loops

MessageMeaning and fix
Condition of 'if' must be BOOLEAN, found INT.A number is not a condition. Write n <> 0.
For loop iterator must be of type INT.Declare the counter as variable i : INT.
Switch must have a default case.Add a default : block at the end of the switch.
Boolean variables cannot be used in switchUse if ... else with a BOOLEAN.
Duplicate case value in switch.Each case value can appear only once.

Functions and procedures

MessageMeaning and fix
Function 'f' must contain at least one 'return' statement.Every path of a function must give a result.
Function 'f' must return INT, found BOOLEAN.The returned value does not match the declared type.
Procedure 'p' cannot return a value.Use a function, or remove the value after return.
Function 'f' expects 2 argument(s), got 1.Check the number of values in the call.

Declarations

MessageMeaning and fix
Duplicate declaration: 'x'Two declarations use the same name. Rename one.
Cannot assign to a constant.A constant never changes. Use a variable.
read() only accepts primitive type variables (INT, REAL, STRING, BOOLEAN).Read the fields of a structure one by one.
This line does nothing: a value alone is not a statement.A line like x + 1 computes a value and loses it. Write x <- x + 1.

Something unclear? Open an issue with your file and the message.

Report a problem with this page