uses GraphABC; var a,b: integer; begin SetWindowSize(500, 500); SetPenWidth(3); Rectangle(50,50,100,100); Rectangle(100,50,150,100); read (a); If a=1 then setbrushcolor(clBlue); Rectangle(50,50,100,100); If a=2 then setbrushcolor(clBlue); Rectangle(100,50,150,100); end. 

Closed due to the fact that off-topic participants Kromster , sercxjo , aleksandr barakin , mymedia , 0xdb March 20 at 22:35 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - mymedia, 0xdb
If the question can be reformulated according to the rules set out in the certificate , edit it .

    2 answers 2

    if there are several statements in if you probably need to use begin .. end? It looks like your rectangles are drawn regardless of the if condition

       uses GraphABC; var a,b: integer; begin SetWindowSize(500, 500); SetPenWidth(3); Rectangle(50,50,100,100); Rectangle(100,50,150,100); read (a); setbrushcolor(clBlue); If a=1 then Rectangle(50,50,100,100); If a=2 then Rectangle(100,50,150,100); end. 

      I understood