4. Missing colon Errors
4.1. If: Missing colon
If the colon is left out from the end of the
if
line, an error occurs.A red triangle shows where the colon should have been.
from microbit import *
# if button_a.is_pressed():
if button_a.is_pressed()
display.scroll('A')
4.2. Elif: Missing colon
If the colon is left out from the end of the
elif
line, an error occurs.A red triangle shows where the colon should have been.
from microbit import *
if button_a.is_pressed():
display.scroll('A')
# elif:
elif
display.scroll('X')
4.3. Else: Missing colon
If the colon is left out from the end of the
else
line, an error occurs.A red triangle shows where the colon should have been.
from microbit import *
if button_a.is_pressed():
display.scroll('A')
# else:
else
display.scroll('X')
4.4. While: Missing colon
If the colon is left out from the end of the
while
line, an error occurs.A red triangle shows where the colon should have been.
from microbit import *
while True
display.scroll("A")
4.5. For: Missing colon
If the colon is left out from the end of the
for
line, an error occurs.A red triangle shows where the colon should have been.
from microbit import *
for num in range(5)
display.scroll(num)