I need help with understanding why my screen won't get cleared before displaying new output

Here an example on how to hide components.

Another example: