As with any written programming language, you occasionally make mistakes and run into errors that you will need to fix in order for your program to run.


The micro:bit Python Editor shows you the errors in your code, so you know what you need to fix before flashing your code to the micro:bit.


Errors are indicated in the margin by a red dot or grey square. They are also indicated  by using  a red triangle or a red wavy underline:


 


Type of errorWhy does this error occur?Example of how this error is indicated
Syntax errorSyntax errors occur when you type something wrong; you could have missed part of a statement or misspelt it.Statements must be separated by newlines or semicolons
Indentation errorIndentation errors occur when you make a mistake with the code structure.Expected indented blockred wavy line and error message "Expected indented block"
Type errorThis happens when you put the wrong type of data in the wrong place in your code, such as trying to add a string to an integerOperertor "x" is not supported for type.
Name errorA name error occurs when you try to use a variable or function that has not been defined yet."a" is not defined
Logic errorThis means that there is nothing wrong with the code regarding indentation and syntax, but the logic of the code or algorithm is incorrect
Unreachable codeThis means that the program you are running never reaches the code indicated by the error