5. Variable Errors

5.1. Variable used which has no value

display.scroll('hello') scrolls ‘hello’ across the microbit.
If ‘hello’ is not in quotes, it will be treated as a variable.
If display.scroll(hello) is used by accident, leaving out the quotes, a variable not defined error occurs.
from microbit import *

display.scroll(hello)
../_images/variable_not_defined.png

This can be fixed by giving the variable a value, as shown below:

from microbit import *

hello = 'Hi'
display.scroll(hello)