[Solved] I’m getting an Error:Illegal Expression


The code is full of errors and would never compile.

  1. You use idnum and payment as array but you’ve declared it as integer! If you need the array, use IDNUMARR and PAYMENTARR instead.
  2. In line 9 and 10 you declare the global var IDNUMARR PAYMENTARR but you declare it again as a local var in the procedure DeclareandInitialiseArrays
  3. Almost all if-statements are invalid

    if(payment[j]=1620 and payment[j]=1980) then

The “and” operator is evaluated always first which results in the logical comparison “1620 and payment[j]” (which is not a valid syntax).

You have to put every comparison into brackets like this:

if(payment[j]=1620) and (payment[j]=1980) then

4. set j:=j+1;
What exactly do you expect should happen??
I think you just want increase j

j:=j+1;
  1. All procedures have to end with ; and not .
  2. the final “begin end.” is missing where you execute all your program.

And probably many others…

4

solved I’m getting an Error:Illegal Expression