6. Whitespace Errors
Whitespace is mainly made up of spaces, tabs and return characters.
Extra spaces can sometimes work even if they shoudn’t be there.
Sometimes extra spaces can also cause errors.
6.2. Whitespace in parentheses: Error
In the if statement below an unneeeded space has been placed in the parentheses.
When Check is pressed, it reports that there is Whitespace after the “(“.
Without fixing this, after flashing to the microbit, it reports a line 4 error.
Press the tidy button to remove the extra whitespace.
from microbit import *
if button_a.is_presed( ):
display.scroll('A')