Looking at https://www.youtube.com/watch?v=zG_cq9t-wGk , the answer is to duplicate the code to turn off the last square before adding to the new sqaure. But to do that you need to remember where the last square was. Just simple logic.
Thanks, Clem, for your reply.
But exactly how do you "turn off the last square" in terms of codes?
To answer this, have you looked at https://support.microbit.org/support/home ? Here you can choose many languages to program the microbit hardware. Here is an example https://support.microbit.org/support/solutions/articles/19000069989-randomly-fill-the-led-screen . It uses plot command to turn on a LED. Use search to learn more.
I need help.
Context: On button A pressed, I drew a square using the microturtle extension of pen-down. Then on button B pressed, I drew rectangle again using pen-down.
On button A+B pressed, I clear screen
However, I realised that even when I pressed A+B, and then I press say A, the previous pattern of rectangle appears again while the LED drew the square.
Question: how do I permanently erase the pen trail so that I see only rectangle when I press B / see only square when I press A?