Post Reply 
REPEAT . . . UNTIL loop problem
02-16-2021, 09:06 AM (This post was last modified: 02-16-2021 09:15 AM by Didier Lachieze.)
Post: #22
RE: REPEAT . . . UNTIL loop problem
(02-15-2021 11:03 PM)cahlucas Wrote:  Here is the framework of my program, at least the part where you can derive control from. I will not publish the entire program here, to keep the overview as simple as possible. Things unrelated to program control have been left out. But this should be enough to track down the error. I hope you can find it. Sincerely, Karel.

I have cleaned your code to remove the following sources of syntax errors:
  • removed the extra coma in the variable declaration "exit,,"
  • removed the dots on the commented lines: ". . . // "
  • replaced the dots in the IF statements with dummy instructions:
    Code:
        IF N==4 THEN . . . END;
        IF N==5 THEN . . . END;
        IF N==6 THEN . . . END;
and there is no more syntax errors, so the source of your syntax error before UNTIL should be in the code you have removed. It would really help if you can share your whole program. If you don't want to do it publicly, you can send it to me by PM.

Here is the cleaned code that is checking ok both on my Prime G1 V2.1.1445 (2020 01 16) and the virtual Prime same version. Just to remove any potential issue, as your signature mentions the Prime G2, you can check it on your Prime G2 and confirm if you have or not a syntax error:
Code:
#pragma mode( separator(.,;) integer(h32) )

CURSORTOUCH(n,cx,cy);

START()
BEGIN
 LOCAL N,input,exit,cx,cy;
 input:=−1;  exit:=0; 
 
 REPEAT
  input:=WAIT(−1);
  CASE
    IF N==0 THEN  END;
    IF TYPE(input)==6 THEN
      CASE
        IF input(1)==#0h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
        IF input(1)==#1h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
        IF input(1)==#2h THEN
        
        END;
        IF input(1)==#3h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
        IF input(1)==#4h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
        IF input(1)==#5h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
        IF input(1)==#6h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
        IF input(1)==#7h THEN
        cx:=B→R(input(2));
        cy:=B→R(input(3));
        END;
      END;
      CURSORTOUCH(N,cx,cy);
    END;
   IF TYPE(input)==0 THEN 
    CASE
     // More  IF  THEN  END  statements
     IF input==−1 THEN  END;
     IF input==19 THEN exit:=1 END;
     // More  IF  THEN  END  statements
     IF input==37 THEN N:=4 END;
     IF input==38 THEN N:=5 END;
     IF input==39 THEN N:=6 END;
     // More  IF  THEN  END  statements
     DEFAULT END;
    END;
  END;
  CASE  // Display section,  This part manages the screen.
    IF N==4 THEN N:=N END;
    IF N==5 THEN N:=N END;
    IF N==6 THEN N:=N END;
  END;
  FREEZE;
 UNTIL exit==1;
 STARTVIEW(−4,1);
END;

CURSORTOUCH(n,cx,cy)
BEGIN
 // Part where x and y coordinates are processed.
END;

(02-15-2021 11:46 PM)Gene222 Wrote:  That is a lot of IF and CASE statements. I think the syntax of one of the CASE statements is wrong when you are using the DEFAULT statement. I think the DEFAULT statement does not require an END statement. The END of the case statement also acts as the END of the DEFAULT statement. So, you have too many END statements. Take a closer look at the example for the CASE statement in the calculator help.
This doesn't generate any error in the example just above.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
REPEAT . . . UNTIL loop problem - cahlucas - 02-13-2021, 10:50 PM
RE: REPEAT . . . UNTIL loop problem - Didier Lachieze - 02-16-2021 09:06 AM
RE: REPEAT . . . UNTIL loop problem - jte - 01-20-2023, 02:57 AM



User(s) browsing this thread: 7 Guest(s)