One of the problems with computer code is that if the code is many pages long, it is often difficult to remember on (e.g.) page 54 what we have done on (e.g.) page 17. Long experience gathered over decades has shown that even expert programmers produce more reliable code if their code is divided into small chunks that can fit on one computer screen. We call these code chunks “functions”. Let us see if we can change our “edge-follow” code into a code chunk that will fit on one page.
The video below shows how to change our “edge-follow code” into an “edge-follow function” using Blockly. We will then convert the Blockly function into a Python function.